From 39cc28bfaa26a4fe4694cc92dba4f537a96739e7 Mon Sep 17 00:00:00 2001 From: Elias Rohrer Date: Thu, 6 Jun 2024 13:06:59 +0200 Subject: [PATCH] `rustfmt`: `fuzz/src/chanmon_deser.rs` --- fuzz/src/chanmon_deser.rs | 17 +++++++++++++---- rustfmt_excluded_files | 1 - 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/fuzz/src/chanmon_deser.rs b/fuzz/src/chanmon_deser.rs index 8d425357c..b9c012137 100644 --- a/fuzz/src/chanmon_deser.rs +++ b/fuzz/src/chanmon_deser.rs @@ -4,8 +4,8 @@ use bitcoin::hash_types::BlockHash; use lightning::chain::channelmonitor; +use lightning::util::ser::{ReadableArgs, Writeable, Writer}; use lightning::util::test_channel_signer::TestChannelSigner; -use lightning::util::ser::{ReadableArgs, Writer, Writeable}; use lightning::util::test_utils::OnlyReadsKeysInterface; use crate::utils::test_logger; @@ -22,10 +22,19 @@ impl Writer for VecWriter { #[inline] pub fn do_test(data: &[u8], _out: Out) { - if let Ok((latest_block_hash, monitor)) = <(BlockHash, channelmonitor::ChannelMonitor)>::read(&mut Cursor::new(data), (&OnlyReadsKeysInterface {}, &OnlyReadsKeysInterface {})) { + if let Ok((latest_block_hash, monitor)) = + <(BlockHash, channelmonitor::ChannelMonitor)>::read( + &mut Cursor::new(data), + (&OnlyReadsKeysInterface {}, &OnlyReadsKeysInterface {}), + ) { let mut w = VecWriter(Vec::new()); monitor.write(&mut w).unwrap(); - let deserialized_copy = <(BlockHash, channelmonitor::ChannelMonitor)>::read(&mut Cursor::new(&w.0), (&OnlyReadsKeysInterface {}, &OnlyReadsKeysInterface {})).unwrap(); + let deserialized_copy = + <(BlockHash, channelmonitor::ChannelMonitor)>::read( + &mut Cursor::new(&w.0), + (&OnlyReadsKeysInterface {}, &OnlyReadsKeysInterface {}), + ) + .unwrap(); assert!(latest_block_hash == deserialized_copy.0); assert!(monitor == deserialized_copy.1); } @@ -37,5 +46,5 @@ pub fn chanmon_deser_test(data: &[u8], out: Out) { #[no_mangle] pub extern "C" fn chanmon_deser_run(data: *const u8, datalen: usize) { - do_test(unsafe { std::slice::from_raw_parts(data, datalen) }, test_logger::DevNull{}); + do_test(unsafe { std::slice::from_raw_parts(data, datalen) }, test_logger::DevNull {}); } diff --git a/rustfmt_excluded_files b/rustfmt_excluded_files index 177a22b77..89dd4ab41 100644 --- a/rustfmt_excluded_files +++ b/rustfmt_excluded_files @@ -1,6 +1,5 @@ ./bench/benches/bench.rs ./fuzz/src/chanmon_consistency.rs -./fuzz/src/chanmon_deser.rs ./fuzz/src/fromstr_to_netaddress.rs ./fuzz/src/full_stack.rs ./fuzz/src/indexedmap.rs -- 2.39.5