From 09a4b8a5f85f93b598060cb3217d9a6e67746759 Mon Sep 17 00:00:00 2001 From: Daniel Faust Date: Fri, 10 Jan 2025 15:06:00 +0100 Subject: [PATCH] Update dependencies and fix clippy warnings --- Cargo.toml | 4 ++-- examples/debouncer_mini.rs | 6 +++--- examples/debouncer_mini_custom.rs | 4 ++-- notify-debouncer-full/src/time.rs | 14 +++++++------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index de0ec897..12772363 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ repository = "https://github.com/notify-rs/notify.git" edition = "2021" [workspace.dependencies] -bitflags = "2.6.0" +bitflags = "2.7.0" crossbeam-channel = "0.5.0" deser-hjson = "2.2.4" env_logger = "0.11.2" @@ -41,7 +41,7 @@ notify-debouncer-mini = { version = "0.5.0", path = "notify-debouncer-mini" } notify-types = { version = "1.0.0", path = "notify-types" } pretty_assertions = "1.3.0" rand = "0.8.5" -rstest = "0.23.0" +rstest = "0.24.0" serde = { version = "1.0.89", features = ["derive"] } serde_json = "1.0.39" tempfile = "3.10.0" diff --git a/examples/debouncer_mini.rs b/examples/debouncer_mini.rs index 2ac5540c..bff178a6 100644 --- a/examples/debouncer_mini.rs +++ b/examples/debouncer_mini.rs @@ -12,11 +12,11 @@ fn main() { // emit some events by changing a file std::thread::spawn(|| { let path = Path::new("test.txt"); - let _ = std::fs::remove_file(&path); + let _ = std::fs::remove_file(path); // log::info!("running 250ms events"); for _ in 0..20 { log::trace!("writing.."); - std::fs::write(&path, b"Lorem ipsum").unwrap(); + std::fs::write(path, b"Lorem ipsum").unwrap(); std::thread::sleep(Duration::from_millis(250)); } // log::debug!("waiting 20s"); @@ -24,7 +24,7 @@ fn main() { // log::info!("running 3s events"); for _ in 0..20 { // log::debug!("writing.."); - std::fs::write(&path, b"Lorem ipsum").unwrap(); + std::fs::write(path, b"Lorem ipsum").unwrap(); std::thread::sleep(Duration::from_millis(3000)); } }); diff --git a/examples/debouncer_mini_custom.rs b/examples/debouncer_mini_custom.rs index c5654a5f..218c76fb 100644 --- a/examples/debouncer_mini_custom.rs +++ b/examples/debouncer_mini_custom.rs @@ -8,9 +8,9 @@ fn main() { // emit some events by changing a file std::thread::spawn(|| { let path = Path::new("test.txt"); - let _ = std::fs::remove_file(&path); + let _ = std::fs::remove_file(path); loop { - std::fs::write(&path, b"Lorem ipsum").unwrap(); + std::fs::write(path, b"Lorem ipsum").unwrap(); std::thread::sleep(Duration::from_millis(250)); } }); diff --git a/notify-debouncer-full/src/time.rs b/notify-debouncer-full/src/time.rs index 772aa06f..2e1f1664 100644 --- a/notify-debouncer-full/src/time.rs +++ b/notify-debouncer-full/src/time.rs @@ -1,3 +1,6 @@ +#[cfg(not(test))] +pub use build::*; + #[cfg(not(test))] mod build { use std::time::Instant; @@ -7,8 +10,8 @@ mod build { } } -#[cfg(not(test))] -pub use build::*; +#[cfg(test)] +pub use test::*; #[cfg(test)] mod test { @@ -18,12 +21,12 @@ mod test { }; thread_local! { - static NOW: Mutex> = Mutex::new(None); + static NOW: Mutex> = const { Mutex::new(None) }; } pub fn now() -> Instant { let time = NOW.with(|now| *now.lock().unwrap()); - time.unwrap_or_else(|| Instant::now()) + time.unwrap_or_else(Instant::now) } pub struct MockTime; @@ -42,6 +45,3 @@ mod test { } } } - -#[cfg(test)] -pub use test::*;