From b9a432e783a3142a3e6f164509d747ffe419a12d Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Thu, 11 Jul 2024 09:18:20 +1000 Subject: [PATCH] Fix clippy warnings --- src/sys/flock/mod.rs | 4 ++-- src/sys/flock/{flock.rs => unix.rs} | 0 tests/simple_tests.rs | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) rename src/sys/flock/{flock.rs => unix.rs} (100%) diff --git a/src/sys/flock/mod.rs b/src/sys/flock/mod.rs index 8252a97..ab48410 100644 --- a/src/sys/flock/mod.rs +++ b/src/sys/flock/mod.rs @@ -13,8 +13,8 @@ cfg_if! { cfg_if! { if #[cfg(unix)] { - mod flock; - pub use self::flock::*; + mod unix; + pub use self::unix::*; } } diff --git a/src/sys/flock/flock.rs b/src/sys/flock/unix.rs similarity index 100% rename from src/sys/flock/flock.rs rename to src/sys/flock/unix.rs diff --git a/tests/simple_tests.rs b/tests/simple_tests.rs index 98cfb29..61bc930 100644 --- a/tests/simple_tests.rs +++ b/tests/simple_tests.rs @@ -77,11 +77,12 @@ fn handle_relative_walk_entries_hashset(handle: &Handle) -> HashSet { .expect("should be able to walk handle dir") .into_iter() .map(|mut entry: WalkEntry| { - entry.path = entry + let suffix = entry .path .strip_prefix(handle.dir()) .expect("walk entry should have handle dir path prefix") .to_owned(); + suffix.clone_into(&mut entry.path); entry }) .collect() @@ -525,6 +526,8 @@ fn test_writeback_mmap() -> anyhow::Result<()> { let mut file = OpenOptions::new() .write(true) .create(true) + // Don't truncate because we're about to it anyway. + .truncate(false) .open("writeback")?; file.set_len(0x1000)?; let read_file = OpenOptions::new().read(true).open("writeback")?;