From f396b26c484ad4adfa28f9be58e43650c8bd69c2 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Tue, 21 Sep 2021 19:16:38 +0300 Subject: Use .cloned() on iterators, instead of .map(|x| x.clone()) 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 --- sq/src/commands/decrypt.rs | 4 ++-- 1 file 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(()) } -- cgit v1.2.3