diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-09-21 19:16:38 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-09-27 09:35:47 +0300 |
commit | f396b26c484ad4adfa28f9be58e43650c8bd69c2 (patch) | |
tree | f61940eed3f36df68b4e6297548781d708d9cccb | |
parent | fc7e8c185ed80799ab2998f10f28a4ca0aeb3e57 (diff) |
Use .cloned() on iterators, instead of .map(|x| x.clone())clippy-bunch
Instead of this:
iter().map(|x| x.clone())
use this:
iter().cloned()
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(()) } |