From b2e37d448b4f4cedc1a0843b6f93b4ab07a353b5 Mon Sep 17 00:00:00 2001 From: Ilya Grigoriev Date: Sat, 10 Feb 2024 15:08:26 -0800 Subject: [PATCH] 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 --- lib/tests/test_local_working_copy.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tests/test_local_working_copy.rs b/lib/tests/test_local_working_copy.rs index 6405ee7e2..dc93a1769 100644 --- a/lib/tests/test_local_working_copy.rs +++ b/lib/tests/test_local_working_copy.rs @@ -516,11 +516,11 @@ fn test_snapshot_racy_timestamps() { let mut previous_tree_id = repo.store().empty_merged_tree_id(); for i in 0..100 { { - // https://github.com/rust-lang/rust-clippy/issues/9778 - #[allow(clippy::needless_borrow)] + // Short-term TODO: Switch to fs::write? let mut file = OpenOptions::new() .create(true) .write(true) + .truncate(true) .open(&file_path) .unwrap(); file.write_all(format!("contents {i}").as_bytes()).unwrap();