Skip to content

Make clippy happy #1780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions crates/chain/src/tx_data_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub trait Anchor: core::fmt::Debug + Clone + Eq + PartialOrd + Ord + core::hash:
}
}

impl<'a, A: Anchor> Anchor for &'a A {
impl<A: Anchor> Anchor for &A {
fn anchor_block(&self) -> BlockId {
<A as Anchor>::anchor_block(self)
}
Expand Down Expand Up @@ -112,13 +112,13 @@ pub struct TxPosInBlock<'b> {
pub tx_pos: usize,
}

impl<'b> From<TxPosInBlock<'b>> for BlockId {
impl From<TxPosInBlock<'_>> for BlockId {
fn from(pos: TxPosInBlock) -> Self {
pos.block_id
}
}

impl<'b> From<TxPosInBlock<'b>> for ConfirmationBlockTime {
impl From<TxPosInBlock<'_>> for ConfirmationBlockTime {
fn from(pos: TxPosInBlock) -> Self {
Self {
block_id: pos.block_id,
Expand Down
6 changes: 3 additions & 3 deletions crates/chain/src/tx_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ pub struct TxNode<'a, T, A> {
pub last_seen_unconfirmed: Option<u64>,
}

impl<'a, T, A> Deref for TxNode<'a, T, A> {
impl<T, A> Deref for TxNode<'_, T, A> {
type Target = T;

fn deref(&self) -> &Self::Target {
Expand Down Expand Up @@ -1350,7 +1350,7 @@ where
}
}

impl<'g, A, F, O> Iterator for TxAncestors<'g, A, F, O>
impl<A, F, O> Iterator for TxAncestors<'_, A, F, O>
where
F: FnMut(usize, Arc<Transaction>) -> Option<O>,
{
Expand Down Expand Up @@ -1470,7 +1470,7 @@ where
}
}

impl<'g, A, F, O> Iterator for TxDescendants<'g, A, F, O>
impl<A, F, O> Iterator for TxDescendants<'_, A, F, O>
where
F: FnMut(usize, Txid) -> Option<O>,
{
Expand Down
2 changes: 1 addition & 1 deletion crates/chain/tests/test_local_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ enum ExpectedResult<'a> {
Err(CannotConnectError),
}

impl<'a> TestLocalChain<'a> {
impl TestLocalChain<'_> {
fn run(mut self) {
let got_changeset = match self.chain.apply_update(self.update) {
Ok(changeset) => changeset,
Expand Down
10 changes: 5 additions & 5 deletions crates/core/src/spk_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub enum SyncItem<'i, I> {
OutPoint(OutPoint),
}

impl<'i, I: core::fmt::Debug + core::any::Any> core::fmt::Display for SyncItem<'i, I> {
impl<I: core::fmt::Debug + core::any::Any> core::fmt::Display for SyncItem<'_, I> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
SyncItem::Spk(i, spk) => {
Expand Down Expand Up @@ -485,7 +485,7 @@ struct KeychainSpkIter<'r, K> {
inspect: &'r mut Box<InspectFullScan<K>>,
}

impl<'r, K: Ord + Clone> Iterator for KeychainSpkIter<'r, K> {
impl<K: Ord + Clone> Iterator for KeychainSpkIter<'_, K> {
type Item = Indexed<ScriptBuf>;

fn next(&mut self) -> Option<Self::Item> {
Expand All @@ -511,7 +511,7 @@ impl<'r, I, Item> SyncIter<'r, I, Item> {

impl<'r, I, Item> ExactSizeIterator for SyncIter<'r, I, Item> where SyncIter<'r, I, Item>: Iterator {}

impl<'r, I> Iterator for SyncIter<'r, I, ScriptBuf> {
impl<I> Iterator for SyncIter<'_, I, ScriptBuf> {
type Item = ScriptBuf;

fn next(&mut self) -> Option<Self::Item> {
Expand All @@ -524,7 +524,7 @@ impl<'r, I> Iterator for SyncIter<'r, I, ScriptBuf> {
}
}

impl<'r, I> Iterator for SyncIter<'r, I, Txid> {
impl<I> Iterator for SyncIter<'_, I, Txid> {
type Item = Txid;

fn next(&mut self) -> Option<Self::Item> {
Expand All @@ -537,7 +537,7 @@ impl<'r, I> Iterator for SyncIter<'r, I, Txid> {
}
}

impl<'r, I> Iterator for SyncIter<'r, I, OutPoint> {
impl<I> Iterator for SyncIter<'_, I, OutPoint> {
type Item = OutPoint;

fn next(&mut self) -> Option<Self::Item> {
Expand Down
4 changes: 2 additions & 2 deletions crates/file_store/src/entry_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl<'t, T> EntryIter<'t, T> {
}
}

impl<'t, T> Iterator for EntryIter<'t, T>
impl<T> Iterator for EntryIter<'_, T>
where
T: serde::de::DeserializeOwned,
{
Expand Down Expand Up @@ -71,7 +71,7 @@ where
}
}

impl<'t, T> Drop for EntryIter<'t, T> {
impl<T> Drop for EntryIter<'_, T> {
fn drop(&mut self) {
// This syncs the underlying file's offset with the buffer's position. This way, we
// maintain the correct position to start the next read/write.
Expand Down
2 changes: 1 addition & 1 deletion crates/testenv/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub struct Config<'a> {
pub electrsd: electrsd::Conf<'a>,
}

impl<'a> Default for Config<'a> {
impl Default for Config<'_> {
/// Use the default configuration plus set `http_enabled = true` for [`electrsd::Conf`]
/// which is required for testing `bdk_esplora`.
fn default() -> Self {
Expand Down
1 change: 0 additions & 1 deletion crates/wallet/examples/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ use bdk_wallet::{KeychainKind, Wallet};
/// can be derived from the policy.
///
/// This example demonstrates the interaction between a bdk wallet and miniscript policy.

#[allow(clippy::print_stdout)]
fn main() -> Result<(), Box<dyn Error>> {
// We start with a miniscript policy string
Expand Down
1 change: 0 additions & 1 deletion crates/wallet/examples/policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use bdk_wallet::signer::SignersContainer;
///
/// This example demos a Policy output for a 2of2 multisig between between 2 parties, where the wallet holds
/// one of the Extend Private key.

#[allow(clippy::print_stdout)]
fn main() -> Result<(), Box<dyn Error>> {
let secp = bitcoin::secp256k1::Secp256k1::new();
Expand Down
4 changes: 1 addition & 3 deletions crates/wallet/src/descriptor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,7 @@ impl IntoWalletDescriptor for (ExtendedDescriptor, KeyMap) {
network: Network,
}

impl<'s, 'd> miniscript::Translator<DescriptorPublicKey, String, DescriptorError>
for Translator<'s, 'd>
{
impl miniscript::Translator<DescriptorPublicKey, String, DescriptorError> for Translator<'_, '_> {
fn pk(&mut self, pk: &DescriptorPublicKey) -> Result<String, DescriptorError> {
let secp = &self.secp;

Expand Down
2 changes: 1 addition & 1 deletion crates/wallet/src/keys/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ impl fmt::Display for KeyError {
impl std::error::Error for KeyError {}

#[cfg(test)]
pub mod test {
mod test {
use bitcoin::bip32;

use super::*;
Expand Down
2 changes: 1 addition & 1 deletion crates/wallet/src/wallet/coin_selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ mod test {
.collect()
}

fn sum_random_utxos(mut rng: &mut StdRng, utxos: &mut Vec<WeightedUtxo>) -> Amount {
fn sum_random_utxos(mut rng: &mut StdRng, utxos: &mut [WeightedUtxo]) -> Amount {
let utxos_picked_len = rng.gen_range(2..utxos.len() / 2);
utxos.shuffle(&mut rng);
utxos[..utxos_picked_len]
Expand Down
2 changes: 1 addition & 1 deletion crates/wallet/src/wallet/persisted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ impl<P: AsyncWalletPersister> PersistedWallet<P> {
}

#[cfg(feature = "rusqlite")]
impl<'c> WalletPersister for bdk_chain::rusqlite::Transaction<'c> {
impl WalletPersister for bdk_chain::rusqlite::Transaction<'_> {
type Error = bdk_chain::rusqlite::Error;

fn initialize(persister: &mut Self) -> Result<ChangeSet, Self::Error> {
Expand Down
2 changes: 1 addition & 1 deletion crates/wallet/src/wallet/tx_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ impl<'a, Cs> TxBuilder<'a, Cs> {
}
}

impl<'a, Cs: CoinSelectionAlgorithm> TxBuilder<'a, Cs> {
impl<Cs: CoinSelectionAlgorithm> TxBuilder<'_, Cs> {
/// Finish building the transaction.
///
/// Uses the thread-local random number generator (rng).
Expand Down
Loading