Skip to content

Commit 63dee9e

Browse files
committed
Use iter instead of into_iter
Clippy emits a bunch of warnings of form: warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice` As suggested, use `iter` instead of `into_iter`.
1 parent 3fdd0f5 commit 63dee9e

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

src/miniscript/iter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext> Miniscript<Pk, Ctx> {
158158
Terminal::PkH(ref hash) => vec![PkPkh::HashedPubkey(hash.clone())],
159159
Terminal::PkK(ref key) => vec![PkPkh::PlainPubkey(key.clone())],
160160
Terminal::Multi(_, ref keys) | Terminal::MultiA(_, ref keys) => keys
161-
.into_iter()
161+
.iter()
162162
.map(|key| PkPkh::PlainPubkey(key.clone()))
163163
.collect(),
164164
_ => vec![],

src/policy/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,12 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext> Liftable<Pk> for Terminal<Pk, Ctx> {
157157
Semantic::Threshold(1, vec![left.node.lift()?, right.node.lift()?])
158158
}
159159
Terminal::Thresh(k, ref subs) => {
160-
let semantic_subs: Result<_, Error> =
161-
subs.into_iter().map(|s| s.node.lift()).collect();
160+
let semantic_subs: Result<_, Error> = subs.iter().map(|s| s.node.lift()).collect();
162161
Semantic::Threshold(k, semantic_subs?)
163162
}
164163
Terminal::Multi(k, ref keys) | Terminal::MultiA(k, ref keys) => Semantic::Threshold(
165164
k,
166-
keys.into_iter()
165+
keys.iter()
167166
.map(|k| Semantic::KeyHash(k.to_pubkeyhash()))
168167
.collect(),
169168
),

src/policy/semantic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ impl<Pk: MiniscriptKey> fmt::Debug for Policy<Pk> {
235235
} else {
236236
write!(f, "thresh({},", k)?;
237237
}
238-
for (i, sub) in subs.into_iter().enumerate() {
238+
for (i, sub) in subs.iter().enumerate() {
239239
if i == 0 {
240240
write!(f, "{}", sub)?;
241241
} else {
@@ -268,7 +268,7 @@ impl<Pk: MiniscriptKey> fmt::Display for Policy<Pk> {
268268
} else {
269269
write!(f, "thresh({},", k)?;
270270
}
271-
for (i, sub) in subs.into_iter().enumerate() {
271+
for (i, sub) in subs.iter().enumerate() {
272272
if i == 0 {
273273
write!(f, "{}", sub)?;
274274
} else {

0 commit comments

Comments
 (0)