diff --git a/src/config.rs b/src/config.rs index 3a3c95f..3cdde22 100644 --- a/src/config.rs +++ b/src/config.rs @@ -18,6 +18,7 @@ const DEFAULT_SERVER_ADDRESS: [u8; 4] = [127, 0, 0, 1]; // by default, serve on mod internal { #![allow(unused)] #![allow(clippy::cognitive_complexity)] + #![allow(clippy::enum_variant_names)] #![allow(clippy::unnecessary_lazy_evaluations)] #![allow(clippy::useless_conversion)] diff --git a/src/db.rs b/src/db.rs index 96d7e1e..b7f11da 100644 --- a/src/db.rs +++ b/src/db.rs @@ -1,7 +1,7 @@ use anyhow::{Context, Result}; use electrs_rocksdb as rocksdb; -use std::path::{Path, PathBuf}; +use std::path::Path; use std::sync::atomic::{AtomicBool, Ordering}; pub(crate) type Row = Box<[u8]>; @@ -24,11 +24,6 @@ impl WriteBatch { } } -#[derive(Debug)] -struct Options { - path: PathBuf, -} - /// RocksDB wrapper for index storage pub struct DBStore { db: rocksdb::DB, diff --git a/src/electrum.rs b/src/electrum.rs index 0dc3d28..268300a 100644 --- a/src/electrum.rs +++ b/src/electrum.rs @@ -347,7 +347,7 @@ impl Rpc { } fn transaction_broadcast(&self, (tx_hex,): &(String,)) -> Result { - let tx_bytes = Vec::from_hex(&tx_hex).context("non-hex transaction")?; + let tx_bytes = Vec::from_hex(tx_hex).context("non-hex transaction")?; let tx = deserialize(&tx_bytes).context("invalid transaction")?; let txid = self.daemon.broadcast(&tx)?; Ok(json!(txid)) @@ -427,17 +427,13 @@ impl Rpc { } pub fn handle_requests(&self, client: &mut Client, lines: &[String]) -> Vec { - let parsed: Vec> = lines + lines .iter() .map(|line| { - parse_requests(&line) + parse_requests(line) .map(Calls::parse) .map_err(error_msg_no_id) }) - .collect(); - - parsed - .into_iter() .map(|calls| self.handle_calls(client, calls).to_string()) .collect() } diff --git a/src/status.rs b/src/status.rs index e20f70a..f72fabf 100644 --- a/src/status.rs +++ b/src/status.rs @@ -331,7 +331,7 @@ impl ScriptHashStatus { let funding_blockhashes = index.limit_result(index.filter_by_funding(scripthash))?; self.for_new_blocks(funding_blockhashes, daemon, |blockhash, block| { let block_entries = result.entry(blockhash).or_default(); - filter_block_txs(block, |tx| filter_outputs(&tx, scripthash)).for_each( + filter_block_txs(block, |tx| filter_outputs(tx, scripthash)).for_each( |FilteredTx { pos, tx, @@ -353,7 +353,7 @@ impl ScriptHashStatus { .collect(); self.for_new_blocks(spending_blockhashes, daemon, |blockhash, block| { let block_entries = result.entry(blockhash).or_default(); - filter_block_txs(block, |tx| filter_inputs(&tx, outpoints)).for_each( + filter_block_txs(block, |tx| filter_inputs(tx, outpoints)).for_each( |FilteredTx { pos, tx, @@ -461,7 +461,7 @@ impl ScriptHashStatus { } } -fn make_outpoints<'a>(txid: Txid, outputs: &'a [TxOutput]) -> impl Iterator + 'a { +fn make_outpoints(txid: Txid, outputs: &[TxOutput]) -> impl Iterator + '_ { outputs .iter() .map(move |out| OutPoint::new(txid, out.index))