Skip to content

Commit b0ed084

Browse files
rustfmt: apply 'visual' indent style config change
1 parent 03d396d commit b0ed084

30 files changed

+11266
-13679
lines changed

fuzz/src/chanmon_consistency.rs

Lines changed: 305 additions & 318 deletions
Large diffs are not rendered by default.

fuzz/src/full_stack.rs

Lines changed: 179 additions & 232 deletions
Large diffs are not rendered by default.

fuzz/src/router.rs

Lines changed: 32 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,10 @@ impl ChainWatchInterface for DummyChainWatcher {
7979
fn filter_block<'a>(&self, _block: &'a Block) -> (Vec<&'a Transaction>, Vec<u32>) { (Vec::new(), Vec::new()) }
8080
fn reentered(&self) -> usize { 0 }
8181

82-
fn get_chain_utxo(
83-
&self,
84-
_genesis_hash: Sha256dHash,
85-
_unspent_tx_output_identifier: u64,
86-
) -> Result<(Script, u64), ChainError> {
82+
fn get_chain_utxo(&self,
83+
_genesis_hash: Sha256dHash,
84+
_unspent_tx_output_identifier: u64)
85+
-> Result<(Script, u64), ChainError> {
8786
match self.input.get_slice(2) {
8887
Some(&[0, _]) => Err(ChainError::NotSupported),
8988
Some(&[1, _]) => Err(ChainError::NotWatched),
@@ -97,10 +96,8 @@ impl ChainWatchInterface for DummyChainWatcher {
9796

9897
#[inline]
9998
pub fn do_test(data: &[u8]) {
100-
let input = Arc::new(InputData {
101-
data: data.to_vec(),
102-
read_pos: AtomicUsize::new(0),
103-
});
99+
let input = Arc::new(InputData { data: data.to_vec(),
100+
read_pos: AtomicUsize::new(0) });
104101
macro_rules! get_slice_nonadvancing {
105102
($len: expr) => {
106103
match input.get_slice_nonadvancing($len as usize) {
@@ -155,9 +152,7 @@ pub fn do_test(data: &[u8]) {
155152
}
156153

157154
let logger: Arc<dyn Logger> = Arc::new(test_logger::TestLogger::new("".to_owned()));
158-
let chain_monitor = Arc::new(DummyChainWatcher {
159-
input: Arc::clone(&input),
160-
});
155+
let chain_monitor = Arc::new(DummyChainWatcher { input: Arc::clone(&input) });
161156

162157
let our_pubkey = get_pubkey!();
163158
let router = Router::new(our_pubkey.clone(), chain_monitor, Arc::clone(&logger));
@@ -167,7 +162,8 @@ pub fn do_test(data: &[u8]) {
167162
0 => {
168163
let start_len = slice_to_be16(&get_slice_nonadvancing!(64 + 2)[64..64 + 2]) as usize;
169164
let addr_len = slice_to_be16(
170-
&get_slice_nonadvancing!(64 + start_len + 2 + 74)[64 + start_len + 2 + 72..64 + start_len + 2 + 74],
165+
&get_slice_nonadvancing!(64 + start_len + 2 + 74)
166+
[64 + start_len + 2 + 72..64 + start_len + 2 + 74],
171167
);
172168
if addr_len > (37 + 1) * 4 {
173169
return;
@@ -207,16 +203,18 @@ pub fn do_test(data: &[u8]) {
207203
1 => {
208204
let count = slice_to_be16(get_slice!(2));
209205
for _ in 0..count {
210-
first_hops_vec.push(ChannelDetails {
211-
channel_id: [0; 32],
212-
short_channel_id: Some(slice_to_be64(get_slice!(8))),
213-
remote_network_id: get_pubkey!(),
214-
channel_value_satoshis: slice_to_be64(get_slice!(8)),
215-
user_id: 0,
216-
inbound_capacity_msat: 0,
217-
is_live: true,
218-
outbound_capacity_msat: 0,
219-
});
206+
first_hops_vec.push(ChannelDetails { channel_id: [0; 32],
207+
short_channel_id: Some(slice_to_be64(get_slice!(
208+
8
209+
))),
210+
remote_network_id: get_pubkey!(),
211+
channel_value_satoshis: slice_to_be64(get_slice!(
212+
8
213+
)),
214+
user_id: 0,
215+
inbound_capacity_msat: 0,
216+
is_live: true,
217+
outbound_capacity_msat: 0, });
220218
}
221219
Some(&first_hops_vec[..])
222220
},
@@ -226,23 +224,21 @@ pub fn do_test(data: &[u8]) {
226224
let last_hops = {
227225
let count = slice_to_be16(get_slice!(2));
228226
for _ in 0..count {
229-
last_hops_vec.push(RouteHint {
230-
src_node_id: get_pubkey!(),
231-
short_channel_id: slice_to_be64(get_slice!(8)),
232-
fee_base_msat: slice_to_be32(get_slice!(4)),
233-
fee_proportional_millionths: slice_to_be32(get_slice!(4)),
234-
cltv_expiry_delta: slice_to_be16(get_slice!(2)),
235-
htlc_minimum_msat: slice_to_be64(get_slice!(8)),
236-
});
227+
last_hops_vec.push(RouteHint { src_node_id: get_pubkey!(),
228+
short_channel_id: slice_to_be64(get_slice!(8)),
229+
fee_base_msat: slice_to_be32(get_slice!(4)),
230+
fee_proportional_millionths: slice_to_be32(get_slice!(4)),
231+
cltv_expiry_delta: slice_to_be16(get_slice!(2)),
232+
htlc_minimum_msat: slice_to_be64(get_slice!(8)), });
237233
}
238234
&last_hops_vec[..]
239235
};
240236
let _ = router.get_route(
241-
&target,
242-
first_hops,
243-
last_hops,
244-
slice_to_be64(get_slice!(8)),
245-
slice_to_be32(get_slice!(4)),
237+
&target,
238+
first_hops,
239+
last_hops,
240+
slice_to_be64(get_slice!(8)),
241+
slice_to_be32(get_slice!(4)),
246242
);
247243
},
248244
_ => return,

fuzz/src/utils/test_logger.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,22 @@ pub struct TestLogger {
66

77
impl TestLogger {
88
pub fn new(_id: String) -> TestLogger {
9-
TestLogger {
10-
#[cfg(test)]
11-
id: _id,
12-
}
9+
TestLogger { #[cfg(test)]
10+
id: _id }
1311
}
1412
}
1513

1614
impl Logger for TestLogger {
1715
fn log(&self, record: &Record) {
1816
#[cfg(test)]
1917
println!(
20-
"{:<5} {} [{} : {}, {}] {}",
21-
record.level.to_string(),
22-
self.id,
23-
record.module_path,
24-
record.file,
25-
record.line,
26-
record.args
18+
"{:<5} {} [{} : {}, {}] {}",
19+
record.level.to_string(),
20+
self.id,
21+
record.module_path,
22+
record.file,
23+
record.line,
24+
record.args
2725
);
2826
#[cfg(not(test))]
2927
let _ = format!("{}", record.args);

0 commit comments

Comments
 (0)