diff options
author | Nora Widdecke <nora@sequoia-pgp.org> | 2021-11-22 12:58:47 +0100 |
---|---|---|
committer | Nora Widdecke <nora@sequoia-pgp.org> | 2021-11-29 11:53:55 +0100 |
commit | 049055e3ff5ffe86700b668e924fbff96e82be94 (patch) | |
tree | 30dfd63e4d1c3016210b698813e99b70787890e8 /sq | |
parent | 97ce753fefae770ee0b5b02a611d75e29a7cd01d (diff) |
Remove unnecessary borrows.
- Fixed with the help of clippy::needless_borrow.
Diffstat (limited to 'sq')
-rw-r--r-- | sq/src/commands/decrypt.rs | 10 | ||||
-rw-r--r-- | sq/src/commands/dump.rs | 2 | ||||
-rw-r--r-- | sq/src/commands/mod.rs | 2 | ||||
-rw-r--r-- | sq/src/commands/net.rs | 2 |
4 files changed, 8 insertions, 8 deletions
diff --git a/sq/src/commands/decrypt.rs b/sq/src/commands/decrypt.rs index eb40fb98..dc8e9a89 100644 --- a/sq/src/commands/decrypt.rs +++ b/sq/src/commands/decrypt.rs @@ -57,7 +57,7 @@ impl PrivateKey for LocalPrivateKey { fn unlock(&mut self, p: &Password) -> Result<Box<dyn Decryptor>> { let algo = self.key.pk_algo(); - self.key.secret_mut().decrypt_in_place(algo, &p)?; + self.key.secret_mut().decrypt_in_place(algo, p)?; let keypair = self.key.clone().into_keypair()?; Ok(Box::new(keypair)) } @@ -84,7 +84,7 @@ impl PrivateKey for RemotePrivateKey { } fn unlock(&mut self, p: &Password) -> Result<Box<dyn Decryptor>> { - Ok(pks::unlock_decryptor(&self.store, self.key.clone(), &p)?) + Ok(pks::unlock_decryptor(&self.store, self.key.clone(), p)?) } } @@ -208,7 +208,7 @@ impl<'a> DecryptionHelper for Helper<'a> { // for a password. for pkesk in pkesks { let keyid = pkesk.recipient(); - if let Some(key) = self.secret_keys.get_mut(&keyid) { + if let Some(key) = self.secret_keys.get_mut(keyid) { if let Some(fp) = key.get_unlocked() .and_then(|k| self.try_decrypt(pkesk, sym_algo, k, &mut decrypt)) @@ -227,7 +227,7 @@ impl<'a> DecryptionHelper for Helper<'a> { } let keyid = pkesk.recipient(); - if let Some(key) = self.secret_keys.get_mut(&keyid) { + if let Some(key) = self.secret_keys.get_mut(keyid) { let keypair = loop { if let Some(keypair) = key.get_unlocked() { break keypair; @@ -236,7 +236,7 @@ impl<'a> DecryptionHelper for Helper<'a> { let p = rpassword::read_password_from_tty(Some( &format!( "Enter password to decrypt key {}: ", - self.key_hints.get(&keyid).unwrap())))?.into(); + self.key_hints.get(keyid).unwrap())))?.into(); match key.unlock(&p) { Ok(decryptor) => break decryptor, diff --git a/sq/src/commands/dump.rs b/sq/src/commands/dump.rs index a1ce9c7f..003657ba 100644 --- a/sq/src/commands/dump.rs +++ b/sq/src/commands/dump.rs @@ -238,7 +238,7 @@ impl PacketDumper { pub fn flush(&self, output: &mut dyn io::Write) -> Result<()> { if let Some(root) = self.root.as_ref() { - self.dump_tree(output, "", &root)?; + self.dump_tree(output, "", root)?; } Ok(()) } diff --git a/sq/src/commands/mod.rs b/sq/src/commands/mod.rs index aff04e3e..85466717 100644 --- a/sq/src/commands/mod.rs +++ b/sq/src/commands/mod.rs @@ -434,7 +434,7 @@ pub fn split(input: &mut (dyn io::Read + Sync + Send), prefix: &str) let mut pos = vec![0]; while let PacketParserResult::Some(pp) = ppr { - if let Some(ref map) = pp.map() { + if let Some(map) = pp.map() { let filename = format!( "{}{}--{}{:?}", prefix, pos.iter().map(|n| format!("{}", n)) diff --git a/sq/src/commands/net.rs b/sq/src/commands/net.rs index 238711a7..068a57af 100644 --- a/sq/src/commands/net.rs +++ b/sq/src/commands/net.rs @@ -42,7 +42,7 @@ fn parse_network_policy(m: &clap::ArgMatches) -> net::Policy { pub fn dispatch_keyserver(config: Config, m: &clap::ArgMatches) -> Result<()> { let network_policy = parse_network_policy(m); let mut ks = if let Some(uri) = m.value_of("server") { - KeyServer::new(network_policy, &uri) + KeyServer::new(network_policy, uri) } else { KeyServer::keys_openpgp_org(network_policy) }.context("Malformed keyserver URI")?; |