Skip to content

Commit af68803

Browse files
bors[bot]taiki-e
andauthored
Merge #438
438: Remove redundant closures r=jeehoonkang a=taiki-e Co-authored-by: Taiki Endo <te316e89@gmail.com>
2 parents 30f5d8b + 31fc7e6 commit af68803

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

crossbeam-channel/benchmarks/futures-channel.rs

+11-17
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ fn spsc_unbounded() {
4848
let (tx, rx) = mpsc::unbounded();
4949

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

6767
cx.spawn(future::lazy(move |_| {
68-
tx.send_all(stream::iter_ok((0..MESSAGES).map(|i| message::new(i))))
68+
tx.send_all(stream::iter_ok((0..MESSAGES).map(message::new)))
6969
.map_err(|_| panic!())
7070
.and_then(|_| future::ok(()))
7171
}));
@@ -84,11 +84,9 @@ fn mpsc_unbounded() {
8484
for _ in 0..THREADS {
8585
let tx = tx.clone();
8686
cx.spawn(future::lazy(move |_| {
87-
tx.send_all(stream::iter_ok(
88-
(0..MESSAGES / THREADS).map(|i| message::new(i)),
89-
))
90-
.map_err(|_| panic!())
91-
.and_then(|_| future::ok(()))
87+
tx.send_all(stream::iter_ok((0..MESSAGES / THREADS).map(message::new)))
88+
.map_err(|_| panic!())
89+
.and_then(|_| future::ok(()))
9290
}));
9391
}
9492
drop(tx);
@@ -107,11 +105,9 @@ fn mpsc_bounded(cap: usize) {
107105
for _ in 0..THREADS {
108106
let tx = tx.clone();
109107
cx.spawn(future::lazy(move |_| {
110-
tx.send_all(stream::iter_ok(
111-
(0..MESSAGES / THREADS).map(|i| message::new(i)),
112-
))
113-
.map_err(|_| panic!())
114-
.and_then(|_| future::ok(()))
108+
tx.send_all(stream::iter_ok((0..MESSAGES / THREADS).map(message::new)))
109+
.map_err(|_| panic!())
110+
.and_then(|_| future::ok(()))
115111
}));
116112
}
117113
drop(tx);
@@ -153,11 +149,9 @@ fn select_rx_bounded(cap: usize) {
153149
for (tx, _) in &chans {
154150
let tx = tx.clone();
155151
cx.spawn(future::lazy(move |_| {
156-
tx.send_all(stream::iter_ok(
157-
(0..MESSAGES / THREADS).map(|i| message::new(i)),
158-
))
159-
.map_err(|_| panic!())
160-
.and_then(|_| future::ok(()))
152+
tx.send_all(stream::iter_ok((0..MESSAGES / THREADS).map(message::new)))
153+
.map_err(|_| panic!())
154+
.and_then(|_| future::ok(()))
161155
}));
162156
}
163157

crossbeam-skiplist/src/map.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,7 @@ impl<'a, K, V> Drop for Entry<'a, K, V>
254254
{
255255
fn drop(&mut self) {
256256
unsafe {
257-
ManuallyDrop::into_inner(ptr::read(&mut self.inner))
258-
.release_with_pin(|| epoch::pin());
257+
ManuallyDrop::into_inner(ptr::read(&mut self.inner)).release_with_pin(epoch::pin);
259258
}
260259
}
261260
}

0 commit comments

Comments
 (0)