From: Elias Rohrer Date: Thu, 6 Jun 2024 11:18:20 +0000 (+0200) Subject: `rustfmt`: `src/utils/*` X-Git-Tag: v0.0.124-beta~91^2~2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=5d0fb36477329def1b859a32479bd23fe7ce3a10;p=rust-lightning `rustfmt`: `src/utils/*` --- diff --git a/fuzz/src/utils/test_logger.rs b/fuzz/src/utils/test_logger.rs index 5e5817e23..6d9de02e3 100644 --- a/fuzz/src/utils/test_logger.rs +++ b/fuzz/src/utils/test_logger.rs @@ -8,10 +8,10 @@ // licenses. use lightning::util::logger::{Logger, Record}; -use std::sync::{Arc, Mutex}; use std::io::Write; +use std::sync::{Arc, Mutex}; -pub trait Output : Clone + 'static { +pub trait Output: Clone + 'static { fn locked_write(&self, data: &[u8]); } @@ -36,7 +36,7 @@ impl StringBuffer { } } -pub struct TestLogger { +pub struct TestLogger { id: String, out: Out, } @@ -52,13 +52,22 @@ impl<'a, Out: Output> Write for LockedWriteAdapter<'a, Out> { self.0.locked_write(data); Ok(data.len()) } - fn flush(&mut self) -> Result<(), std::io::Error> { Ok(()) } + fn flush(&mut self) -> Result<(), std::io::Error> { + Ok(()) + } } impl Logger for TestLogger { fn log(&self, record: Record) { - write!(LockedWriteAdapter(&self.out), - "{:<5} {} [{} : {}] {}\n", record.level.to_string(), self.id, record.module_path, record.line, record.args) - .unwrap(); + write!( + LockedWriteAdapter(&self.out), + "{:<5} {} [{} : {}] {}\n", + record.level.to_string(), + self.id, + record.module_path, + record.line, + record.args + ) + .unwrap(); } } diff --git a/fuzz/src/utils/test_persister.rs b/fuzz/src/utils/test_persister.rs index a99c397d0..7de3cc6be 100644 --- a/fuzz/src/utils/test_persister.rs +++ b/fuzz/src/utils/test_persister.rs @@ -1,6 +1,6 @@ use lightning::chain; -use lightning::chain::{chainmonitor, channelmonitor}; use lightning::chain::transaction::OutPoint; +use lightning::chain::{chainmonitor, channelmonitor}; use lightning::util::test_channel_signer::TestChannelSigner; use std::sync::Mutex; @@ -9,14 +9,18 @@ pub struct TestPersister { pub update_ret: Mutex, } impl chainmonitor::Persist for TestPersister { - fn persist_new_channel(&self, _funding_txo: OutPoint, _data: &channelmonitor::ChannelMonitor) -> chain::ChannelMonitorUpdateStatus { + fn persist_new_channel( + &self, _funding_txo: OutPoint, _data: &channelmonitor::ChannelMonitor, + ) -> chain::ChannelMonitorUpdateStatus { self.update_ret.lock().unwrap().clone() } - fn update_persisted_channel(&self, _funding_txo: OutPoint, _update: Option<&channelmonitor::ChannelMonitorUpdate>, _data: &channelmonitor::ChannelMonitor) -> chain::ChannelMonitorUpdateStatus { + fn update_persisted_channel( + &self, _funding_txo: OutPoint, _update: Option<&channelmonitor::ChannelMonitorUpdate>, + _data: &channelmonitor::ChannelMonitor, + ) -> chain::ChannelMonitorUpdateStatus { self.update_ret.lock().unwrap().clone() } - fn archive_persisted_channel(&self, _: OutPoint) { - } + fn archive_persisted_channel(&self, _: OutPoint) {} } diff --git a/rustfmt_excluded_files b/rustfmt_excluded_files index 2e8aa253d..e013632c1 100644 --- a/rustfmt_excluded_files +++ b/rustfmt_excluded_files @@ -1,9 +1,6 @@ ./bench/benches/bench.rs ./fuzz/src/chanmon_consistency.rs ./fuzz/src/full_stack.rs -./fuzz/src/utils/mod.rs -./fuzz/src/utils/test_logger.rs -./fuzz/src/utils/test_persister.rs ./fuzz/src/zbase32.rs ./lightning-background-processor/src/lib.rs ./lightning-block-sync/src/convert.rs