Skip to content

Commit ec2b4ed

Browse files
rustfmt: apply 'visual' indent style config change
1 parent a2588df commit ec2b4ed

30 files changed

+11341
-13744
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
@@ -83,11 +83,10 @@ impl ChainWatchInterface for DummyChainWatcher {
8383
0
8484
}
8585

86-
fn get_chain_utxo(
87-
&self,
88-
_genesis_hash: Sha256dHash,
89-
_unspent_tx_output_identifier: u64,
90-
) -> Result<(Script, u64), ChainError> {
86+
fn get_chain_utxo(&self,
87+
_genesis_hash: Sha256dHash,
88+
_unspent_tx_output_identifier: u64)
89+
-> Result<(Script, u64), ChainError> {
9190
match self.input.get_slice(2) {
9291
Some(&[0, _]) => Err(ChainError::NotSupported),
9392
Some(&[1, _]) => Err(ChainError::NotWatched),
@@ -101,10 +100,8 @@ impl ChainWatchInterface for DummyChainWatcher {
101100

102101
#[inline]
103102
pub fn do_test(data: &[u8]) {
104-
let input = Arc::new(InputData {
105-
data: data.to_vec(),
106-
read_pos: AtomicUsize::new(0),
107-
});
103+
let input = Arc::new(InputData { data: data.to_vec(),
104+
read_pos: AtomicUsize::new(0) });
108105
macro_rules! get_slice_nonadvancing {
109106
($len: expr) => {
110107
match input.get_slice_nonadvancing($len as usize) {
@@ -159,9 +156,7 @@ pub fn do_test(data: &[u8]) {
159156
}
160157

161158
let logger: Arc<dyn Logger> = Arc::new(test_logger::TestLogger::new("".to_owned()));
162-
let chain_monitor = Arc::new(DummyChainWatcher {
163-
input: Arc::clone(&input),
164-
});
159+
let chain_monitor = Arc::new(DummyChainWatcher { input: Arc::clone(&input) });
165160

166161
let our_pubkey = get_pubkey!();
167162
let router = Router::new(our_pubkey.clone(), chain_monitor, Arc::clone(&logger));
@@ -171,7 +166,8 @@ pub fn do_test(data: &[u8]) {
171166
0 => {
172167
let start_len = slice_to_be16(&get_slice_nonadvancing!(64 + 2)[64..64 + 2]) as usize;
173168
let addr_len = slice_to_be16(
174-
&get_slice_nonadvancing!(64 + start_len + 2 + 74)[64 + start_len + 2 + 72..64 + start_len + 2 + 74],
169+
&get_slice_nonadvancing!(64 + start_len + 2 + 74)
170+
[64 + start_len + 2 + 72..64 + start_len + 2 + 74],
175171
);
176172
if addr_len > (37 + 1) * 4 {
177173
return;
@@ -211,16 +207,18 @@ pub fn do_test(data: &[u8]) {
211207
1 => {
212208
let count = slice_to_be16(get_slice!(2));
213209
for _ in 0..count {
214-
first_hops_vec.push(ChannelDetails {
215-
channel_id: [0; 32],
216-
short_channel_id: Some(slice_to_be64(get_slice!(8))),
217-
remote_network_id: get_pubkey!(),
218-
channel_value_satoshis: slice_to_be64(get_slice!(8)),
219-
user_id: 0,
220-
inbound_capacity_msat: 0,
221-
is_live: true,
222-
outbound_capacity_msat: 0,
223-
});
210+
first_hops_vec.push(ChannelDetails { channel_id: [0; 32],
211+
short_channel_id: Some(slice_to_be64(get_slice!(
212+
8
213+
))),
214+
remote_network_id: get_pubkey!(),
215+
channel_value_satoshis: slice_to_be64(get_slice!(
216+
8
217+
)),
218+
user_id: 0,
219+
inbound_capacity_msat: 0,
220+
is_live: true,
221+
outbound_capacity_msat: 0, });
224222
}
225223
Some(&first_hops_vec[..])
226224
},
@@ -230,23 +228,21 @@ pub fn do_test(data: &[u8]) {
230228
let last_hops = {
231229
let count = slice_to_be16(get_slice!(2));
232230
for _ in 0..count {
233-
last_hops_vec.push(RouteHint {
234-
src_node_id: get_pubkey!(),
235-
short_channel_id: slice_to_be64(get_slice!(8)),
236-
fee_base_msat: slice_to_be32(get_slice!(4)),
237-
fee_proportional_millionths: slice_to_be32(get_slice!(4)),
238-
cltv_expiry_delta: slice_to_be16(get_slice!(2)),
239-
htlc_minimum_msat: slice_to_be64(get_slice!(8)),
240-
});
231+
last_hops_vec.push(RouteHint { src_node_id: get_pubkey!(),
232+
short_channel_id: slice_to_be64(get_slice!(8)),
233+
fee_base_msat: slice_to_be32(get_slice!(4)),
234+
fee_proportional_millionths: slice_to_be32(get_slice!(4)),
235+
cltv_expiry_delta: slice_to_be16(get_slice!(2)),
236+
htlc_minimum_msat: slice_to_be64(get_slice!(8)), });
241237
}
242238
&last_hops_vec[..]
243239
};
244240
let _ = router.get_route(
245-
&target,
246-
first_hops,
247-
last_hops,
248-
slice_to_be64(get_slice!(8)),
249-
slice_to_be32(get_slice!(4)),
241+
&target,
242+
first_hops,
243+
last_hops,
244+
slice_to_be64(get_slice!(8)),
245+
slice_to_be32(get_slice!(4)),
250246
);
251247
},
252248
_ => 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)