summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorEmīls <emils@mullvad.net>2020-02-18 15:38:12 +0000
committerEmīls <emils@mullvad.net>2020-02-18 15:39:54 +0000
commit0a81a1b85a3faea15db207d642490dfe95de7f3c (patch)
treed94818f9260a15cbd32f0590fcd9bc2bdca1f788
parent647f0b9bcc5f00f8a8d9651781c434601900fcb0 (diff)
downloadmullvadvpn-0a81a1b85a3faea15db207d642490dfe95de7f3c.tar.xz
mullvadvpn-0a81a1b85a3faea15db207d642490dfe95de7f3c.zip
Fix some clippy lints
-rw-r--r--mullvad-daemon/src/wireguard.rs22
1 files changed, 9 insertions, 13 deletions
diff --git a/mullvad-daemon/src/wireguard.rs b/mullvad-daemon/src/wireguard.rs
index 641054e16d..413c19aa12 100644
--- a/mullvad-daemon/src/wireguard.rs
+++ b/mullvad-daemon/src/wireguard.rs
@@ -154,7 +154,6 @@ impl KeyManager {
old_key,
new_key,
))
- .map_err(Self::map_rpc_error)
}
@@ -219,17 +218,14 @@ impl KeyManager {
Ok(())
});
- match self
+ let result = self
.tokio_remote
.execute(fut)
- .map_err(|_| Error::ExectuionError)
- {
- Ok(res) => {
- self.current_job = Some(cancel_handle);
- Ok(res)
- }
- Err(e) => Err(e),
+ .map_err(|_| Error::ExectuionError);
+ if result.is_ok() {
+ self.current_job = Some(cancel_handle);
}
+ result
}
@@ -261,10 +257,11 @@ impl KeyManager {
account: AccountToken,
old_key: PublicKey,
new_key: PrivateKey,
- ) -> impl Future<Item = WireguardData, Error = JsonRpcError> + Send {
- let mut rpc = mullvad_rpc::WireguardKeyProxy::new(http_handle.clone());
+ ) -> impl Future<Item = WireguardData, Error = Error> + Send {
+ let mut rpc = mullvad_rpc::WireguardKeyProxy::new(http_handle);
let new_public_key = new_key.public_key();
- rpc.replace_wg_key(account.clone(), old_key.key, new_public_key)
+ rpc.replace_wg_key(account, old_key.key, new_public_key)
+ .map_err(Self::map_rpc_error)
.map(move |addresses| WireguardData {
private_key: new_key,
addresses,
@@ -316,7 +313,6 @@ impl KeyManager {
let private_key = PrivateKey::new_from_random();
Self::replace_key_rpc(http_handle, account_token, public_key, private_key)
- .map_err(Self::map_rpc_error)
})
.then(move |rpc_result| {
match rpc_result {