Skip to content

Commit

Permalink
Update dependencies and fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
dfaust committed Jan 10, 2025
1 parent e812c01 commit 09a4b8a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions examples/debouncer_mini.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ 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");
std::thread::sleep(Duration::from_millis(20000));
// 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));
}
});
Expand Down
4 changes: 2 additions & 2 deletions examples/debouncer_mini_custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
});
Expand Down
14 changes: 7 additions & 7 deletions notify-debouncer-full/src/time.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#[cfg(not(test))]
pub use build::*;

#[cfg(not(test))]
mod build {
use std::time::Instant;
Expand All @@ -7,8 +10,8 @@ mod build {
}
}

#[cfg(not(test))]
pub use build::*;
#[cfg(test)]
pub use test::*;

#[cfg(test)]
mod test {
Expand All @@ -18,12 +21,12 @@ mod test {
};

thread_local! {
static NOW: Mutex<Option<Instant>> = Mutex::new(None);
static NOW: Mutex<Option<Instant>> = 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;
Expand All @@ -42,6 +45,3 @@ mod test {
}
}
}

#[cfg(test)]
pub use test::*;

0 comments on commit 09a4b8a

Please sign in to comment.