diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2019-06-12 14:52:14 +0200 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2019-06-12 15:17:07 +0200 |
| commit | 21a79f54b028e5be26aa1b94b2145f1338bdc8c3 (patch) | |
| tree | 0fed3760c26bbe5388f8a91901ed253dc90b00dc | |
| parent | 110f26d6fc8b0ea734c2da086399370e9f05922e (diff) | |
| download | mullvadvpn-21a79f54b028e5be26aa1b94b2145f1338bdc8c3.tar.xz mullvadvpn-21a79f54b028e5be26aa1b94b2145f1338bdc8c3.zip | |
Use .is_{err,ok,none}() instead of pattern matching
| -rw-r--r-- | mullvad-daemon/src/account_history.rs | 2 | ||||
| -rw-r--r-- | mullvad-daemon/src/lib.rs | 2 | ||||
| -rw-r--r-- | talpid-core/src/routing/linux/mod.rs | 2 | ||||
| -rw-r--r-- | talpid-core/src/routing/mod.rs | 4 |
4 files changed, 5 insertions, 5 deletions
diff --git a/mullvad-daemon/src/account_history.rs b/mullvad-daemon/src/account_history.rs index 2857de510f..d1ef1d9efd 100644 --- a/mullvad-daemon/src/account_history.rs +++ b/mullvad-daemon/src/account_history.rs @@ -111,7 +111,7 @@ impl AccountHistory { /// Bumps history of an account token. If the account token is not in history, it will be /// added. pub fn bump_history(&mut self, account: &AccountToken) -> Result<()> { - if let None = self.get(account)? { + if self.get(account)?.is_none() { let new_entry = AccountEntry { account: account.to_string(), wireguard: None, diff --git a/mullvad-daemon/src/lib.rs b/mullvad-daemon/src/lib.rs index 42c87d0024..0d2cb7f551 100644 --- a/mullvad-daemon/src/lib.rs +++ b/mullvad-daemon/src/lib.rs @@ -799,7 +799,7 @@ where tx: oneshot::Sender<()>, account_token: AccountToken, ) { - if let Ok(_) = self.account_history.remove_account(&account_token) { + if self.account_history.remove_account(&account_token).is_ok() { Self::oneshot_send(tx, (), "remove_account_from_history response"); } } diff --git a/talpid-core/src/routing/linux/mod.rs b/talpid-core/src/routing/linux/mod.rs index 77e5c372bd..c39431acda 100644 --- a/talpid-core/src/routing/linux/mod.rs +++ b/talpid-core/src/routing/linux/mod.rs @@ -460,7 +460,7 @@ impl Future for RouteManagerImpl { let all_changes_applied = self.apply_route_table_changes()?; if all_changes_applied && self.should_shut_down { if let Some(tx) = self.shutdown_finished_tx.take() { - if let Err(_) = tx.send(()) { + if tx.send(()).is_err() { log::error!("RouteManagerHandle already stopped"); } } diff --git a/talpid-core/src/routing/mod.rs b/talpid-core/src/routing/mod.rs index 2651e9e2f7..f6153fa41c 100644 --- a/talpid-core/src/routing/mod.rs +++ b/talpid-core/src/routing/mod.rs @@ -62,12 +62,12 @@ impl RouteManager { pub fn stop(&mut self) { if let Some(tx) = self.tx.take() { let (wait_tx, wait_rx) = oneshot::channel(); - if let Err(_) = tx.send(wait_tx) { + if tx.send(wait_tx).is_err() { log::error!("RouteManager already down!"); return; } - if let Err(_) = wait_rx.wait() { + if wait_rx.wait().is_err() { log::error!("RouteManager paniced while shutting down"); } } |
