forked from mirrors/jj
clippy: add truncate
option as suggested by clippy
In the next commit, I replace the whole thing with std::fs::write, but I'll leave this here in case the next commit is somhow incorrect
This commit is contained in:
parent
a88c06068e
commit
b2e37d448b
1 changed files with 2 additions and 2 deletions
|
@ -516,11 +516,11 @@ fn test_snapshot_racy_timestamps() {
|
||||||
let mut previous_tree_id = repo.store().empty_merged_tree_id();
|
let mut previous_tree_id = repo.store().empty_merged_tree_id();
|
||||||
for i in 0..100 {
|
for i in 0..100 {
|
||||||
{
|
{
|
||||||
// https://github.com/rust-lang/rust-clippy/issues/9778
|
// Short-term TODO: Switch to fs::write?
|
||||||
#[allow(clippy::needless_borrow)]
|
|
||||||
let mut file = OpenOptions::new()
|
let mut file = OpenOptions::new()
|
||||||
.create(true)
|
.create(true)
|
||||||
.write(true)
|
.write(true)
|
||||||
|
.truncate(true)
|
||||||
.open(&file_path)
|
.open(&file_path)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
file.write_all(format!("contents {i}").as_bytes()).unwrap();
|
file.write_all(format!("contents {i}").as_bytes()).unwrap();
|
||||||
|
|
Loading…
Reference in a new issue