Skip to content

Commit 0780343

Browse files
committed
samples: bench: Run cargo fmt
Update the code to the rustfmt suggested formatting. Signed-off-by: David Brown <[email protected]>
1 parent cccd8a6 commit 0780343

File tree

1 file changed

+27
-19
lines changed

1 file changed

+27
-19
lines changed

samples/bench/src/lib.rs

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,16 @@ impl ThreadTests {
182182
});
183183

184184
// Calculate a size to show.
185-
printkln!("worker size: {} bytes",
186-
work_size(
187-
Self::ping_pong_worker_async(
188-
result.clone(),
189-
0,
190-
result.sems[0].clone(),
191-
result.back_sems[0].clone(),
192-
6)));
185+
printkln!(
186+
"worker size: {} bytes",
187+
work_size(Self::ping_pong_worker_async(
188+
result.clone(),
189+
0,
190+
result.sems[0].clone(),
191+
result.back_sems[0].clone(),
192+
6
193+
))
194+
);
193195

194196
result
195197
}
@@ -308,7 +310,13 @@ impl ThreadTests {
308310
}
309311

310312
Command::SemPingPong(count) => {
311-
this.ping_pong_worker(id, &this.sems[id], &this.back_sems[id], count, &mut total);
313+
this.ping_pong_worker(
314+
id,
315+
&this.sems[id],
316+
&this.back_sems[id],
317+
count,
318+
&mut total,
319+
);
312320
}
313321

314322
Command::SemOnePingPong(count) => {
@@ -379,10 +387,7 @@ impl ThreadTests {
379387
);
380388
if id == 0 {
381389
spawn(
382-
Self::ping_pong_replier_async(
383-
this.clone(),
384-
count,
385-
),
390+
Self::ping_pong_replier_async(this.clone(), count),
386391
&this.workq,
387392
c"giver",
388393
);
@@ -407,11 +412,7 @@ impl ThreadTests {
407412
);
408413
}
409414
spawn(
410-
Self::one_ping_pong_replier_async(
411-
this.clone(),
412-
nthread,
413-
count,
414-
),
415+
Self::one_ping_pong_replier_async(this.clone(), nthread, count),
415416
&this.workq,
416417
c"giver",
417418
);
@@ -506,7 +507,14 @@ impl ThreadTests {
506507
}
507508

508509
/// Worker side of the ping pong sem, takes the 'sem' and gives to the back_sem.
509-
fn ping_pong_worker(&self, id: usize, sem: &Semaphore, back_sem: &Semaphore, count: usize, total: &mut usize) {
510+
fn ping_pong_worker(
511+
&self,
512+
id: usize,
513+
sem: &Semaphore,
514+
back_sem: &Semaphore,
515+
count: usize,
516+
total: &mut usize,
517+
) {
510518
for i in 0..count {
511519
if false {
512520
if let Ok(_) = sem.take(NoWait) {

0 commit comments

Comments
 (0)