diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-09-21 19:16:38 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@sequoia-pgp.org> | 2021-09-30 08:31:06 +0300 |
commit | 36891c7ff02eb662aaf429bc43564b329bfcab18 (patch) | |
tree | cf235644222c3615b2ea78c48dfe543fefc9fd89 | |
parent | 9bfda022641315914a0f03e4721f3a769660c00e (diff) |
Use .cloned() on iterators, instead of .map(|x| x.clone())
The dedicated method on iterators is shorter and more to the point,
and should thus be easier to understand.
Found by clippy lint map_clone:
https://rust-lang.github.io/rust-clippy/master/index.html#map_clone
-rw-r--r-- | sq/src/commands/decrypt.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sq/src/commands/decrypt.rs b/sq/src/commands/decrypt.rs index 5a8a038e..f8102e7e 100644 --- a/sq/src/commands/decrypt.rs +++ b/sq/src/commands/decrypt.rs @@ -102,7 +102,7 @@ impl<'a> Helper<'a> { if self.dump_session_key { eprintln!("Session key: {}", hex::encode(&sk)); } - Some(self.key_identities.get(&keyid).map(|fp| fp.clone())) + Some(self.key_identities.get(&keyid).cloned()) }, None => None, } @@ -115,7 +115,7 @@ impl<'a> VerificationHelper for Helper<'a> { dumper.packet(&mut io::stderr(), pp.recursion_depth() as usize, pp.header().clone(), pp.packet.clone(), - pp.map().map(|m| m.clone()), None)?; + pp.map().cloned(), None)?; } Ok(()) } |