Skip to content

Commit a923855

Browse files
committed
Do not use redundant closures
Clippy emits: warning: redundant closure As suggested, remove the redundant closures. Doing so causes a variable to no longer require mut, fix that also.
1 parent 4ab7e7a commit a923855

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

src/descriptor/key.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ impl FromStr for DescriptorPublicKey {
456456
derivation_path: derivation_paths
457457
.into_iter()
458458
.next()
459-
.unwrap_or_else(|| bip32::DerivationPath::default()),
459+
.unwrap_or_else(bip32::DerivationPath::default),
460460
wildcard,
461461
}))
462462
}
@@ -719,7 +719,7 @@ impl FromStr for DescriptorSecretKey {
719719
derivation_path: derivation_paths
720720
.into_iter()
721721
.next()
722-
.unwrap_or_else(|| bip32::DerivationPath::default()),
722+
.unwrap_or_else(bip32::DerivationPath::default),
723723
wildcard,
724724
}))
725725
}

src/descriptor/sortedmulti.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,11 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext> SortedMultiVec<Pk, Ctx> {
112112
}
113113

114114
impl<Pk: MiniscriptKey, Ctx: ScriptContext> ForEachKey<Pk> for SortedMultiVec<Pk, Ctx> {
115-
fn for_each_key<'a, F: FnMut(&'a Pk) -> bool>(&'a self, mut pred: F) -> bool
115+
fn for_each_key<'a, F: FnMut(&'a Pk) -> bool>(&'a self, pred: F) -> bool
116116
where
117117
Pk: 'a,
118118
{
119-
self.pks.iter().all(|key| pred(key))
119+
self.pks.iter().all(pred)
120120
}
121121
}
122122

src/miniscript/astelem.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,7 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext> Terminal<Pk, Ctx> {
113113
&& c.real_for_each_key(pred)
114114
}
115115
Terminal::Thresh(_, ref subs) => subs.iter().all(|sub| sub.real_for_each_key(pred)),
116-
Terminal::Multi(_, ref keys) | Terminal::MultiA(_, ref keys) => {
117-
keys.iter().all(|key| pred(key))
118-
}
116+
Terminal::Multi(_, ref keys) | Terminal::MultiA(_, ref keys) => keys.iter().all(pred),
119117
}
120118
}
121119

0 commit comments

Comments
 (0)