From 8d04128c7428b7127b7700a386f954efbe3b67e0 Mon Sep 17 00:00:00 2001 From: Steve Myers Date: Wed, 28 Oct 2020 15:34:46 -0700 Subject: [PATCH] [ci] Fix or ignore clippy warnings for all optional features except compact_filters --- src/cli.rs | 16 ++++++++-------- src/database/any.rs | 2 +- src/lib.rs | 3 +++ src/wallet/mod.rs | 2 +- src/wallet/utils.rs | 1 + 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index 06b74fcb..ad492841 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -41,7 +41,7 @@ use crate::types::ScriptType; use crate::{FeeRate, TxBuilder, Wallet}; fn parse_recipient(s: &str) -> Result<(Script, u64), String> { - let parts: Vec<_> = s.split(":").collect(); + let parts: Vec<_> = s.split(':').collect(); if parts.len() != 2 { return Err("Invalid format".to_string()); } @@ -387,7 +387,7 @@ where .unwrap() .map(|s| parse_recipient(s)) .collect::, _>>() - .map_err(|s| Error::Generic(s))?; + .map_err(Error::Generic)?; let mut tx_builder = TxBuilder::with_recipients(recipients); if sub_matches.is_present("send_all") { @@ -405,7 +405,7 @@ where let utxos = utxos .map(|i| parse_outpoint(i)) .collect::, _>>() - .map_err(|s| Error::Generic(s.to_string()))?; + .map_err(Error::Generic)?; tx_builder = tx_builder.utxos(utxos).manually_selected_only(); } @@ -413,7 +413,7 @@ where let unspendable = unspendable .map(|i| parse_outpoint(i)) .collect::, _>>() - .map_err(|s| Error::Generic(s.to_string()))?; + .map_err(Error::Generic)?; tx_builder = tx_builder.unspendable(unspendable); } if let Some(policy) = sub_matches.value_of("policy") { @@ -443,7 +443,7 @@ where let utxos = utxos .map(|i| parse_outpoint(i)) .collect::, _>>() - .map_err(|s| Error::Generic(s.to_string()))?; + .map_err(Error::Generic)?; tx_builder = tx_builder.utxos(utxos); } @@ -451,7 +451,7 @@ where let unspendable = unspendable .map(|i| parse_outpoint(i)) .collect::, _>>() - .map_err(|s| Error::Generic(s.to_string()))?; + .map_err(Error::Generic)?; tx_builder = tx_builder.unspendable(unspendable); } @@ -475,7 +475,7 @@ where let psbt: PartiallySignedTransaction = deserialize(&psbt).unwrap(); let assume_height = sub_matches .value_of("assume_height") - .and_then(|s| Some(s.parse().unwrap())); + .map(|s| s.parse().unwrap()); let (psbt, finalized) = wallet.sign(psbt, assume_height)?; Ok(json!({ "psbt": base64::encode(&serialize(&psbt)), @@ -507,7 +507,7 @@ where let assume_height = sub_matches .value_of("assume_height") - .and_then(|s| Some(s.parse().unwrap())); + .map(|s| s.parse().unwrap()); let (psbt, finalized) = wallet.finalize_psbt(psbt, assume_height)?; Ok(json!({ diff --git a/src/database/any.rs b/src/database/any.rs index 805f8eab..6f9339d0 100644 --- a/src/database/any.rs +++ b/src/database/any.rs @@ -322,7 +322,7 @@ impl BatchDatabase for AnyDatabase { } fn commit_batch(&mut self, batch: Self::Batch) -> Result<(), Error> { // TODO: refactor once `move_ref_pattern` is stable - + #[allow(irrefutable_let_patterns)] match self { AnyDatabase::Memory(db) => { if let AnyBatch::Memory(batch) = batch { diff --git a/src/lib.rs b/src/lib.rs index 69fc670e..cc943afa 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -61,12 +61,15 @@ pub extern crate sled; #[cfg(feature = "cli-utils")] pub mod cli; +#[allow(unused_imports)] #[cfg(test)] #[macro_use] extern crate testutils; +#[allow(unused_imports)] #[cfg(test)] #[macro_use] extern crate testutils_macros; +#[allow(unused_imports)] #[cfg(test)] #[macro_use] extern crate serial_test; diff --git a/src/wallet/mod.rs b/src/wallet/mod.rs index 845da0f0..68c6e91c 100644 --- a/src/wallet/mod.rs +++ b/src/wallet/mod.rs @@ -1753,7 +1753,7 @@ mod test { fn test_create_tx_absolute_high_fee() { let (wallet, _, _) = get_funded_wallet(get_test_wpkh()); let addr = wallet.get_new_address().unwrap(); - let (psbt, details) = wallet + let (_psbt, _details) = wallet .create_tx( TxBuilder::with_recipients(vec![(addr.script_pubkey(), 0)]) .fee_absolute(60_000) diff --git a/src/wallet/utils.rs b/src/wallet/utils.rs index b6d2c95a..fcd3b650 100644 --- a/src/wallet/utils.rs +++ b/src/wallet/utils.rs @@ -103,6 +103,7 @@ pub struct ChunksIterator { } impl ChunksIterator { + #[allow(dead_code)] pub fn new(iter: I, size: usize) -> Self { ChunksIterator { iter, size } }