Skip to content

Commit a61f71a

Browse files
committed
clippy: eliminate a bunch of redundant into_iter calls
1 parent 25fdc0d commit a61f71a

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/descriptor/key.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ impl<K: InnerXKey> DescriptorXKey<K> {
943943
Some((fingerprint, ref path)) => (
944944
fingerprint,
945945
path.into_iter()
946-
.chain(self.derivation_path.into_iter())
946+
.chain(&self.derivation_path)
947947
.collect(),
948948
),
949949
None => (

src/plan.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ impl Plan {
383383
.entry(pk)
384384
.and_modify(|(leaf_hashes, _)| {
385385
if let Some(lh) = leaf_hash {
386-
if leaf_hashes.iter().find(|&&i| i == lh).is_none() {
386+
if leaf_hashes.iter().all(|&i| i != lh) {
387387
leaf_hashes.push(lh);
388388
}
389389
}
@@ -661,15 +661,15 @@ pub trait IntoAssets {
661661
}
662662

663663
impl IntoAssets for KeyMap {
664-
fn into_assets(self) -> Assets { Assets::from_iter(self.into_iter().map(|(k, _)| k)) }
664+
fn into_assets(self) -> Assets { Assets::from_iter(self.into_keys()) }
665665
}
666666

667667
impl IntoAssets for DescriptorPublicKey {
668668
fn into_assets(self) -> Assets { vec![self].into_assets() }
669669
}
670670

671671
impl IntoAssets for Vec<DescriptorPublicKey> {
672-
fn into_assets(self) -> Assets { Assets::from_iter(self.into_iter()) }
672+
fn into_assets(self) -> Assets { Assets::from_iter(self) }
673673
}
674674

675675
impl IntoAssets for sha256::Hash {
@@ -723,14 +723,14 @@ impl Assets {
723723
}
724724

725725
fn append(&mut self, b: Self) {
726-
self.keys.extend(b.keys.into_iter());
727-
self.sha256_preimages.extend(b.sha256_preimages.into_iter());
726+
self.keys.extend(b.keys);
727+
self.sha256_preimages.extend(b.sha256_preimages);
728728
self.hash256_preimages
729-
.extend(b.hash256_preimages.into_iter());
729+
.extend(b.hash256_preimages);
730730
self.ripemd160_preimages
731-
.extend(b.ripemd160_preimages.into_iter());
731+
.extend(b.ripemd160_preimages);
732732
self.hash160_preimages
733-
.extend(b.hash160_preimages.into_iter());
733+
.extend(b.hash160_preimages);
734734

735735
self.relative_timelock = b.relative_timelock.or(self.relative_timelock);
736736
self.absolute_timelock = b.absolute_timelock.or(self.absolute_timelock);

0 commit comments

Comments
 (0)