Skip to content

Commit

Permalink
fix: Cargo clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
danielabrozzoni committed May 2, 2024
1 parent 08fac47 commit 718cafd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions crates/chain/src/local_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ impl Iterator for CheckPointIter {

fn next(&mut self) -> Option<Self::Item> {
let current = self.current.clone()?;
self.current = current.prev.clone();
self.current.clone_from(&current.prev);
Some(CheckPoint(current))
}
}
Expand Down Expand Up @@ -359,7 +359,7 @@ impl LocalChain {
/// The [`BTreeMap`] enforces the height order. However, the caller must ensure the blocks are
/// all of the same chain.
pub fn from_blocks(blocks: BTreeMap<u32, BlockHash>) -> Result<Self, MissingGenesisError> {
if blocks.get(&0).is_none() {
if !blocks.contains_key(&0) {
return Err(MissingGenesisError);
}

Expand Down
2 changes: 1 addition & 1 deletion crates/chain/src/spk_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ impl<K: Ord + Clone> FullScanRequest<K> {
match self.spks_by_keychain.remove(&keychain) {
Some(keychain_spks) => self
.spks_by_keychain
.insert(keychain, Box::new(keychain_spks.chain(spks.into_iter()))),
.insert(keychain, Box::new(keychain_spks.chain(spks))),

Check failure on line 260 in crates/chain/src/spk_client.rs

View workflow job for this annotation

GitHub Actions / clippy

type mismatch resolving `<impl IntoIterator<IntoIter = impl Iterator<Item = (u32, ScriptBuf)> + Send + 'static> as IntoIterator>::Item == (u32, ScriptBuf)`

error[E0271]: type mismatch resolving `<impl IntoIterator<IntoIter = impl Iterator<Item = (u32, ScriptBuf)> + Send + 'static> as IntoIterator>::Item == (u32, ScriptBuf)` --> crates/chain/src/spk_client.rs:260:64 | 260 | .insert(keychain, Box::new(keychain_spks.chain(spks))), | ----- ^^^^ expected `(u32, ScriptBuf)`, found associated type | | | required by a bound introduced by this call | = note: expected tuple `(u32, bitcoin::ScriptBuf)` found associated type `<impl IntoIterator<IntoIter = impl Iterator<Item = (u32, ScriptBuf)> + Send + 'static> as core::iter::IntoIterator>::Item` note: required by a bound in `core::iter::Iterator::chain` --> /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/iter/traits/iterator.rs:480:5 help: consider constraining the associated type `<impl IntoIterator<IntoIter = impl Iterator<Item = (u32, ScriptBuf)> + Send + 'static> as core::iter::IntoIterator>::Item` to `(u32, bitcoin::ScriptBuf)` | 255 | spks: impl IntoIterator<IntoIter = impl Iterator<Item = (u32, ScriptBuf)> + Send + 'static, Item = (u32, bitcoin::ScriptBuf)>, | ++++++++++++++++++++++++++++++++++
None => self
.spks_by_keychain
.insert(keychain, Box::new(spks.into_iter())),
Expand Down
2 changes: 1 addition & 1 deletion crates/chain/src/spk_txout_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ impl<I: Clone + Ord> SpkTxOutIndex<I> {
/// Here, "unused" means that after the script pubkey was stored in the index, the index has
/// never scanned a transaction output with it.
pub fn is_used(&self, index: &I) -> bool {
self.unused.get(index).is_none()
!self.unused.contains(index)
}

/// Marks the script pubkey at `index` as used even though it hasn't seen an output spending to it.
Expand Down

0 comments on commit 718cafd

Please sign in to comment.