mirror of
https://github.com/romanz/electrs.git
synced 2024-11-19 01:43:29 +01:00
Fix a few clippy warnings
Found with `cargo +stable clippy`.
This commit is contained in:
parent
6a3165af43
commit
4f6d5a4d4a
@ -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)]
|
||||
|
||||
|
@ -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,
|
||||
|
@ -347,7 +347,7 @@ impl Rpc {
|
||||
}
|
||||
|
||||
fn transaction_broadcast(&self, (tx_hex,): &(String,)) -> Result<Value> {
|
||||
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<String> {
|
||||
let parsed: Vec<Result<Calls, Value>> = 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()
|
||||
}
|
||||
|
@ -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<Item = OutPoint> + 'a {
|
||||
fn make_outpoints(txid: Txid, outputs: &[TxOutput]) -> impl Iterator<Item = OutPoint> + '_ {
|
||||
outputs
|
||||
.iter()
|
||||
.map(move |out| OutPoint::new(txid, out.index))
|
||||
|
Loading…
Reference in New Issue
Block a user