summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-09-27 15:04:33 +0300
committerLars Wirzenius <liw@sequoia-pgp.org>2021-09-30 08:31:09 +0300
commitca60dfac80459e5fc91d4d6a5b8e76895d3a0f47 (patch)
treea203852e43459d37f786281b25c6f84dc55b7b65
parentb7ebecb5e98c2eb2103f8dab0bc609e2aeb63632 (diff)
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
-rw-r--r--openpgp/src/packet/signature/subpacket.rs2
-rw-r--r--openpgp/src/types/key_flags.rs4
2 files changed, 3 insertions, 3 deletions
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;
}