From ca60dfac80459e5fc91d4d6a5b8e76895d3a0f47 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Mon, 27 Sep 2021 15:04:33 +0300 Subject: Use .iter() instead of .into_iter() Just call the .iter() method instead of .into_iter() when either is OK. The shorter form is shorter and should thus be easier to read. Found by clippy lint into_iter_on_ref: https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref --- openpgp/src/packet/signature/subpacket.rs | 2 +- openpgp/src/types/key_flags.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'openpgp') diff --git a/openpgp/src/packet/signature/subpacket.rs b/openpgp/src/packet/signature/subpacket.rs index f71647d5..558d3f9c 100644 --- a/openpgp/src/packet/signature/subpacket.rs +++ b/openpgp/src/packet/signature/subpacket.rs @@ -6869,7 +6869,7 @@ impl signature::SignatureBuilder { where T: AsRef<[Fingerprint]> { self.hashed_area.remove_all(SubpacketTag::IntendedRecipient); - for fp in recipients.as_ref().into_iter() { + for fp in recipients.as_ref().iter() { self.hashed_area.add( Subpacket::new(SubpacketValue::IntendedRecipient(fp.clone()), false)?)?; } diff --git a/openpgp/src/types/key_flags.rs b/openpgp/src/types/key_flags.rs index 292afb6a..03bf9f1f 100644 --- a/openpgp/src/types/key_flags.rs +++ b/openpgp/src/types/key_flags.rs @@ -113,7 +113,7 @@ impl BitAnd for &KeyFlags { let r = rhs.as_slice(); let mut c = Vec::with_capacity(std::cmp::min(l.len(), r.len())); - for (l, r) in l.into_iter().zip(r.into_iter()) { + for (l, r) in l.iter().zip(r.iter()) { c.push(l & r); } @@ -136,7 +136,7 @@ impl BitOr for &KeyFlags { }; let mut l = l.to_vec(); - for (i, r) in r.into_iter().enumerate() { + for (i, r) in r.iter().enumerate() { l[i] |= r; } -- cgit v1.2.3