Skip to content

Commit

Permalink
Fix clippy::single_match warning
Browse files Browse the repository at this point in the history
```
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
```
  • Loading branch information
taiki-e committed Feb 16, 2022
1 parent a174117 commit 9ec7707
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions futures-executor/src/thread_pool.rs
Expand Up @@ -346,9 +346,8 @@ impl fmt::Debug for Task {

impl ArcWake for WakeHandle {
fn wake_by_ref(arc_self: &Arc<Self>) {
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))
}
}
}
Expand Down

0 comments on commit 9ec7707

Please sign in to comment.