1
0
mirror of https://github.com/romanz/electrs.git synced 2024-11-19 01:43:29 +01:00

fix deprecation and clippy warnings (#1042)

This commit is contained in:
Antoni Spaanderman 2024-05-26 07:29:32 +02:00 committed by GitHub
parent 603830f1b9
commit 953988c00f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 4 additions and 4 deletions

View File

@ -2,7 +2,7 @@ use anyhow::{Context, Result};
use electrs_rocksdb::{ColumnFamilyDescriptor, IteratorMode, Options, DB}; use electrs_rocksdb::{ColumnFamilyDescriptor, IteratorMode, Options, DB};
fn main() -> Result<()> { fn main() -> Result<()> {
let path = std::env::args().skip(1).next().context("missing DB path")?; let path = std::env::args().nth(1).context("missing DB path")?;
let cf_names = DB::list_cf(&Options::default(), &path)?; let cf_names = DB::list_cf(&Options::default(), &path)?;
let cfs: Vec<_> = cf_names let cfs: Vec<_> = cf_names
.iter() .iter()

View File

@ -183,7 +183,7 @@ fn default_daemon_dir() -> PathBuf {
fn default_config_files() -> Vec<OsString> { fn default_config_files() -> Vec<OsString> {
let mut files = vec![OsString::from("electrs.toml")]; // cwd let mut files = vec![OsString::from("electrs.toml")]; // cwd
if let Some(mut path) = home_dir() { if let Some(mut path) = home_dir() {
path.extend(&[".electrs", "config.toml"]); path.extend([".electrs", "config.toml"]);
files.push(OsString::from(path)) // home directory files.push(OsString::from(path)) // home directory
} }
files.push(OsString::from("/etc/electrs/config.toml")); // system-wide files.push(OsString::from("/etc/electrs/config.toml")); // system-wide

View File

@ -344,7 +344,7 @@ impl Serialize for FeeHistogram {
let mut seq = serializer.serialize_seq(Some(self.vsize.len()))?; let mut seq = serializer.serialize_seq(Some(self.vsize.len()))?;
// https://electrumx-spesmilo.readthedocs.io/en/latest/protocol-methods.html#mempool-get-fee-histogram // https://electrumx-spesmilo.readthedocs.io/en/latest/protocol-methods.html#mempool-get-fee-histogram
let fee_rates = let fee_rates =
(0..FeeHistogram::BINS).map(|i| std::u64::MAX.checked_shr(i as u32).unwrap_or(0)); (0..FeeHistogram::BINS).map(|i| u64::MAX.checked_shr(i as u32).unwrap_or(0));
fee_rates fee_rates
.zip(self.vsize.iter().copied()) .zip(self.vsize.iter().copied())
.skip_while(|(_fee_rate, vsize)| *vsize == 0) .skip_while(|(_fee_rate, vsize)| *vsize == 0)

View File

@ -108,6 +108,6 @@ mod tests {
.join(block_hash_hex); .join(block_hash_hex);
let data = std::fs::read(path).unwrap(); let data = std::fs::read(path).unwrap();
let block: Block = deserialize(&data).unwrap(); let block: Block = deserialize(&data).unwrap();
block.txdata.iter().map(|tx| tx.txid()).collect() block.txdata.iter().map(|tx| tx.compute_txid()).collect()
} }
} }