Skip to content

Commit

Permalink
Discard Result<> from spawn whenever a JoinHandle isn't required
Browse files Browse the repository at this point in the history
  • Loading branch information
Jasper-Bekkers authored and 0xpr03 committed Feb 14, 2022
1 parent 833ee36 commit ec249d9
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/fsevent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ impl FsEventWatcher {
fs::FSEventStreamInvalidate(stream);
fs::FSEventStreamRelease(stream);
}
});
})?;
// block until runloop has been sent
self.runloop = Some((rl_rx.recv().unwrap().0, thread_handle));

Expand Down
4 changes: 2 additions & 2 deletions src/inotify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl EventLoop {

// Run the event loop.
pub fn run(self) {
thread::Builder::new()
let _ = thread::Builder::new()
.name("notify-rs inotify".to_string())
.spawn(|| self.event_loop_thread());
}
Expand Down Expand Up @@ -420,7 +420,7 @@ impl EventLoop {
let event_loop_tx = self.event_loop_tx.clone();
let waker = self.event_loop_waker.clone();
let cookie = rename_event.tracker().unwrap(); // unwrap is safe because rename_event is always set with some cookie
thread::Builder::new()
let _ = thread::Builder::new()
.name("notify-rs inotify rename".to_string())
.spawn(move || {
thread::sleep(Duration::from_millis(10)); // wait up to 10 ms for a subsequent event
Expand Down
2 changes: 1 addition & 1 deletion src/kqueue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl EventLoop {

// Run the event loop.
pub fn run(self) {
thread::Builder::new()
let _ = thread::Builder::new()
.name("notify-rs kqueue".to_string())
.spawn(|| self.event_loop_thread());
}
Expand Down
2 changes: 1 addition & 1 deletion src/poll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl PollWatcher {
let event_handler = self.event_handler.clone();
let event_handler = move |res| emit_event(&event_handler, res);

thread::Builder::new()
let _ = thread::Builder::new()
.name("notify-rs poll".to_string())
.spawn(move || {
// In order of priority:
Expand Down
2 changes: 1 addition & 1 deletion src/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl ReadDirectoryChangesServer {
let (action_tx, action_rx) = unbounded();
// it is, in fact, ok to send the semaphore across threads
let sem_temp = wakeup_sem as u64;
thread::Builder::new()
let _ = thread::Builder::new()
.name("notify-rs windows".to_string())
.spawn(move || {
let wakeup_sem = sem_temp as HANDLE;
Expand Down
2 changes: 1 addition & 1 deletion tests/race-with-remove-dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn test_race_with_remove_dir() {

{
let tmpdir = tmpdir.path().to_path_buf();
thread::Builder::new()
let _ = thread::Builder::new()
.name("notify-rs test-race-with-remove-dir".to_string())
.spawn(move || {
let mut watcher = notify::recommended_watcher(move |result| {
Expand Down

0 comments on commit ec249d9

Please sign in to comment.