From 9ec770782cf2e98c93ee43f9568088396687b05b Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Mon, 14 Feb 2022 01:20:59 +0900 Subject: [PATCH] Fix clippy::single_match warning ``` error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` --> futures-executor/src/thread_pool.rs:349:9 | 349 | / match arc_self.mutex.notify() { 350 | | Ok(task) => arc_self.exec.state.send(Message::Run(task)), 351 | | Err(()) => {} 352 | | } | |_________^ help: try this: `if let Ok(task) = arc_self.mutex.notify() { arc_self.exec.state.send(Message::Run(task)) }` | = note: `-D clippy::single-match` implied by `-D warnings` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match ``` --- futures-executor/src/thread_pool.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/futures-executor/src/thread_pool.rs b/futures-executor/src/thread_pool.rs index 5e1f586eb8..3eca9d1440 100644 --- a/futures-executor/src/thread_pool.rs +++ b/futures-executor/src/thread_pool.rs @@ -346,9 +346,8 @@ impl fmt::Debug for Task { impl ArcWake for WakeHandle { fn wake_by_ref(arc_self: &Arc) { - match arc_self.mutex.notify() { - Ok(task) => arc_self.exec.state.send(Message::Run(task)), - Err(()) => {} + if let Ok(task) = arc_self.mutex.notify() { + arc_self.exec.state.send(Message::Run(task)) } } }