Skip to content

Commit

Permalink
Rustfmt everything
Browse files Browse the repository at this point in the history
  • Loading branch information
Stjepan Glavina committed Feb 21, 2019
1 parent ea2f68e commit 2076c5a
Show file tree
Hide file tree
Showing 59 changed files with 729 additions and 522 deletions.
9 changes: 6 additions & 3 deletions crossbeam-channel/benchmarks/atomicring.rs
Expand Up @@ -52,7 +52,8 @@ fn spsc(cap: usize) {
}
}
}
}).unwrap();
})
.unwrap();
}

fn mpsc(cap: usize) {
Expand Down Expand Up @@ -82,7 +83,8 @@ fn mpsc(cap: usize) {
}
}
}
}).unwrap();
})
.unwrap();
}

fn mpmc(cap: usize) {
Expand Down Expand Up @@ -115,7 +117,8 @@ fn mpmc(cap: usize) {
}
});
}
}).unwrap();
})
.unwrap();
}

fn main() {
Expand Down
9 changes: 6 additions & 3 deletions crossbeam-channel/benchmarks/atomicringqueue.rs
Expand Up @@ -46,7 +46,8 @@ fn spsc(cap: usize) {
for _ in 0..MESSAGES {
q.pop();
}
}).unwrap();
})
.unwrap();
}

fn mpsc(cap: usize) {
Expand All @@ -70,7 +71,8 @@ fn mpsc(cap: usize) {
for _ in 0..MESSAGES {
q.pop();
}
}).unwrap();
})
.unwrap();
}

fn mpmc(cap: usize) {
Expand Down Expand Up @@ -98,7 +100,8 @@ fn mpmc(cap: usize) {
}
});
}
}).unwrap();
})
.unwrap();
}

fn main() {
Expand Down
3 changes: 2 additions & 1 deletion crossbeam-channel/benchmarks/bus.rs
Expand Up @@ -34,7 +34,8 @@ fn spsc(cap: usize) {
for _ in 0..MESSAGES {
rx.recv().unwrap();
}
}).unwrap();
})
.unwrap();
}

fn main() {
Expand Down
15 changes: 10 additions & 5 deletions crossbeam-channel/benchmarks/chan.rs
Expand Up @@ -39,7 +39,8 @@ fn spsc(cap: Option<usize>) {
for _ in 0..MESSAGES {
rx.recv().unwrap();
}
}).unwrap();
})
.unwrap();
}

fn mpsc(cap: Option<usize>) {
Expand All @@ -57,7 +58,8 @@ fn mpsc(cap: Option<usize>) {
for _ in 0..MESSAGES {
rx.recv().unwrap();
}
}).unwrap();
})
.unwrap();
}

fn mpmc(cap: Option<usize>) {
Expand All @@ -79,7 +81,8 @@ fn mpmc(cap: Option<usize>) {
}
});
}
}).unwrap();
})
.unwrap();
}

fn select_rx(cap: Option<usize>) {
Expand Down Expand Up @@ -108,7 +111,8 @@ fn select_rx(cap: Option<usize>) {
rx3.recv() -> m => assert!(m.is_some()),
}
}
}).unwrap();
})
.unwrap();
}

fn select_both(cap: Option<usize>) {
Expand Down Expand Up @@ -153,7 +157,8 @@ fn select_both(cap: Option<usize>) {
}
});
}
}).unwrap();
})
.unwrap();
}

fn main() {
Expand Down
15 changes: 10 additions & 5 deletions crossbeam-channel/benchmarks/crossbeam-channel.rs
Expand Up @@ -40,7 +40,8 @@ fn spsc(cap: Option<usize>) {
for _ in 0..MESSAGES {
rx.recv().unwrap();
}
}).unwrap();
})
.unwrap();
}

fn mpsc(cap: Option<usize>) {
Expand All @@ -58,7 +59,8 @@ fn mpsc(cap: Option<usize>) {
for _ in 0..MESSAGES {
rx.recv().unwrap();
}
}).unwrap();
})
.unwrap();
}

fn mpmc(cap: Option<usize>) {
Expand All @@ -80,7 +82,8 @@ fn mpmc(cap: Option<usize>) {
}
});
}
}).unwrap();
})
.unwrap();
}

fn select_rx(cap: Option<usize>) {
Expand All @@ -105,7 +108,8 @@ fn select_rx(cap: Option<usize>) {
let index = case.index();
case.recv(&chans[index].1).unwrap();
}
}).unwrap();
})
.unwrap();
}

fn select_both(cap: Option<usize>) {
Expand Down Expand Up @@ -139,7 +143,8 @@ fn select_both(cap: Option<usize>) {
}
});
}
}).unwrap();
})
.unwrap();
}

fn main() {
Expand Down
7 changes: 4 additions & 3 deletions crossbeam-channel/benchmarks/crossbeam-deque.rs
@@ -1,7 +1,7 @@
extern crate crossbeam;
extern crate crossbeam_deque as deque;

use deque::{Worker, Steal};
use deque::{Steal, Worker};
use std::thread;

mod message;
Expand All @@ -18,7 +18,7 @@ fn seq() {

for _ in 0..MESSAGES {
match rx.steal() {
Steal::Success(_) => {},
Steal::Success(_) => {}
Steal::Retry => panic!(),
Steal::Empty => panic!(),
}
Expand Down Expand Up @@ -46,7 +46,8 @@ fn spsc() {
}
}
});
}).unwrap();
})
.unwrap();
}

fn main() {
Expand Down
48 changes: 31 additions & 17 deletions crossbeam-channel/benchmarks/futures-channel.rs
Expand Up @@ -22,7 +22,8 @@ fn seq_unbounded() {
drop(tx);

rx.for_each(|_| future::ok(()))
})).unwrap();
}))
.unwrap();
}

fn seq_bounded(cap: usize) {
Expand All @@ -36,7 +37,8 @@ fn seq_bounded(cap: usize) {
drop(tx);

rx.for_each(|_| future::ok(()))
})).unwrap();
}))
.unwrap();
}

fn spsc_unbounded() {
Expand All @@ -52,7 +54,8 @@ fn spsc_unbounded() {
}));

rx.for_each(|_| future::ok(()))
})).unwrap();
}))
.unwrap();
}

fn spsc_bounded(cap: usize) {
Expand All @@ -68,7 +71,8 @@ fn spsc_bounded(cap: usize) {
}));

rx.for_each(|_| future::ok(()))
})).unwrap();
}))
.unwrap();
}

fn mpsc_unbounded() {
Expand All @@ -80,15 +84,18 @@ fn mpsc_unbounded() {
for _ in 0..THREADS {
let tx = tx.clone();
cx.spawn(future::lazy(move |_| {
tx.send_all(stream::iter_ok((0..MESSAGES / THREADS).map(|i| message::new(i))))
.map_err(|_| panic!())
.and_then(|_| future::ok(()))
tx.send_all(stream::iter_ok(
(0..MESSAGES / THREADS).map(|i| message::new(i)),
))
.map_err(|_| panic!())
.and_then(|_| future::ok(()))
}));
}
drop(tx);

rx.for_each(|_| future::ok(()))
})).unwrap();
}))
.unwrap();
}

fn mpsc_bounded(cap: usize) {
Expand All @@ -100,15 +107,18 @@ fn mpsc_bounded(cap: usize) {
for _ in 0..THREADS {
let tx = tx.clone();
cx.spawn(future::lazy(move |_| {
tx.send_all(stream::iter_ok((0..MESSAGES / THREADS).map(|i| message::new(i))))
.map_err(|_| panic!())
.and_then(|_| future::ok(()))
tx.send_all(stream::iter_ok(
(0..MESSAGES / THREADS).map(|i| message::new(i)),
))
.map_err(|_| panic!())
.and_then(|_| future::ok(()))
}));
}
drop(tx);

rx.for_each(|_| future::ok(()))
})).unwrap();
}))
.unwrap();
}

fn select_rx_unbounded() {
Expand All @@ -130,7 +140,8 @@ fn select_rx_unbounded() {
stream::select_all(chans.into_iter().map(|(_, rx)| rx))
.for_each(|_| future::ok(()))
.and_then(|_| future::ok(()))
})).unwrap();
}))
.unwrap();
}

fn select_rx_bounded(cap: usize) {
Expand All @@ -142,16 +153,19 @@ fn select_rx_bounded(cap: usize) {
for (tx, _) in &chans {
let tx = tx.clone();
cx.spawn(future::lazy(move |_| {
tx.send_all(stream::iter_ok((0..MESSAGES / THREADS).map(|i| message::new(i))))
.map_err(|_| panic!())
.and_then(|_| future::ok(()))
tx.send_all(stream::iter_ok(
(0..MESSAGES / THREADS).map(|i| message::new(i)),
))
.map_err(|_| panic!())
.and_then(|_| future::ok(()))
}));
}

stream::select_all(chans.into_iter().map(|(_, rx)| rx))
.for_each(|_| future::ok(()))
.and_then(|_| future::ok(()))
})).unwrap();
}))
.unwrap();
}

fn main() {
Expand Down
9 changes: 6 additions & 3 deletions crossbeam-channel/benchmarks/lockfree.rs
Expand Up @@ -39,7 +39,8 @@ fn spsc() {
thread::yield_now();
}
}
}).unwrap();
})
.unwrap();
}

fn mpsc() {
Expand All @@ -59,7 +60,8 @@ fn mpsc() {
thread::yield_now();
}
}
}).unwrap();
})
.unwrap();
}

fn mpmc() {
Expand All @@ -83,7 +85,8 @@ fn mpmc() {
}
});
}
}).unwrap();
})
.unwrap();
}

fn main() {
Expand Down
9 changes: 6 additions & 3 deletions crossbeam-channel/benchmarks/mpmc.rs
Expand Up @@ -51,7 +51,8 @@ fn spsc(cap: usize) {
}
}
}
}).unwrap();
})
.unwrap();
}

fn mpsc(cap: usize) {
Expand Down Expand Up @@ -81,7 +82,8 @@ fn mpsc(cap: usize) {
}
}
}
}).unwrap();
})
.unwrap();
}

fn mpmc(cap: usize) {
Expand Down Expand Up @@ -115,7 +117,8 @@ fn mpmc(cap: usize) {
}
});
}
}).unwrap();
})
.unwrap();
}

fn main() {
Expand Down

0 comments on commit 2076c5a

Please sign in to comment.