]> git.bitcoin.ninja Git - rust-lightning/commitdiff
`rustfmt`: `src/utils/*`
authorElias Rohrer <dev@tnull.de>
Thu, 6 Jun 2024 11:18:20 +0000 (13:18 +0200)
committerElias Rohrer <dev@tnull.de>
Fri, 7 Jun 2024 18:42:36 +0000 (20:42 +0200)
fuzz/src/utils/test_logger.rs
fuzz/src/utils/test_persister.rs
rustfmt_excluded_files

index 5e5817e23f1f92d18f5d83406db2cff23319491d..6d9de02e387b62b4c8577d8c0f3496b6fe1b9067 100644 (file)
@@ -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<Out : Output> {
+pub struct TestLogger<Out: Output> {
        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<Out: Output> Logger for TestLogger<Out> {
        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();
        }
 }
index a99c397d0b2341c8c4b8b6d76b1f13a345c85540..7de3cc6bebb5252a3feaa25c8983d6060c3560c0 100644 (file)
@@ -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<chain::ChannelMonitorUpdateStatus>,
 }
 impl chainmonitor::Persist<TestChannelSigner> for TestPersister {
-       fn persist_new_channel(&self, _funding_txo: OutPoint, _data: &channelmonitor::ChannelMonitor<TestChannelSigner>) -> chain::ChannelMonitorUpdateStatus {
+       fn persist_new_channel(
+               &self, _funding_txo: OutPoint, _data: &channelmonitor::ChannelMonitor<TestChannelSigner>,
+       ) -> chain::ChannelMonitorUpdateStatus {
                self.update_ret.lock().unwrap().clone()
        }
 
-       fn update_persisted_channel(&self, _funding_txo: OutPoint, _update: Option<&channelmonitor::ChannelMonitorUpdate>, _data: &channelmonitor::ChannelMonitor<TestChannelSigner>) -> chain::ChannelMonitorUpdateStatus {
+       fn update_persisted_channel(
+               &self, _funding_txo: OutPoint, _update: Option<&channelmonitor::ChannelMonitorUpdate>,
+               _data: &channelmonitor::ChannelMonitor<TestChannelSigner>,
+       ) -> chain::ChannelMonitorUpdateStatus {
                self.update_ret.lock().unwrap().clone()
        }
 
-       fn archive_persisted_channel(&self, _: OutPoint) {
-       }
+       fn archive_persisted_channel(&self, _: OutPoint) {}
 }
index 2e8aa253ddcfd6a83608233237a52aca375fde6c..e013632c1ee47c5fb5c812e50f238c1634b26c12 100644 (file)
@@ -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