Skip to content

Commit

Permalink
Merge #438
Browse files Browse the repository at this point in the history
438: Remove redundant closures r=jeehoonkang a=taiki-e



Co-authored-by: Taiki Endo <[email protected]>
  • Loading branch information
bors[bot] and taiki-e authored Oct 22, 2019
2 parents 30f5d8b + 31fc7e6 commit af68803
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
28 changes: 11 additions & 17 deletions crossbeam-channel/benchmarks/futures-channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fn spsc_unbounded() {
let (tx, rx) = mpsc::unbounded();

cx.spawn(future::lazy(move |_| {
tx.send_all(stream::iter_ok((0..MESSAGES).map(|i| message::new(i))))
tx.send_all(stream::iter_ok((0..MESSAGES).map(message::new)))
.map_err(|_| panic!())
.and_then(|_| future::ok(()))
}));
Expand All @@ -65,7 +65,7 @@ fn spsc_bounded(cap: usize) {
let (tx, rx) = mpsc::channel(cap);

cx.spawn(future::lazy(move |_| {
tx.send_all(stream::iter_ok((0..MESSAGES).map(|i| message::new(i))))
tx.send_all(stream::iter_ok((0..MESSAGES).map(message::new)))
.map_err(|_| panic!())
.and_then(|_| future::ok(()))
}));
Expand All @@ -84,11 +84,9 @@ 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(message::new)))
.map_err(|_| panic!())
.and_then(|_| future::ok(()))
}));
}
drop(tx);
Expand All @@ -107,11 +105,9 @@ 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(message::new)))
.map_err(|_| panic!())
.and_then(|_| future::ok(()))
}));
}
drop(tx);
Expand Down Expand Up @@ -153,11 +149,9 @@ 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(message::new)))
.map_err(|_| panic!())
.and_then(|_| future::ok(()))
}));
}

Expand Down
3 changes: 1 addition & 2 deletions crossbeam-skiplist/src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,7 @@ impl<'a, K, V> Drop for Entry<'a, K, V>
{
fn drop(&mut self) {
unsafe {
ManuallyDrop::into_inner(ptr::read(&mut self.inner))
.release_with_pin(|| epoch::pin());
ManuallyDrop::into_inner(ptr::read(&mut self.inner)).release_with_pin(epoch::pin);
}
}
}
Expand Down

0 comments on commit af68803

Please sign in to comment.