summaryrefslogtreecommitdiff
path: root/src/sys/aio.rs
diff options
context:
space:
mode:
authorAlan Somers <asomers@gmail.com>2018-11-28 10:47:12 -0700
committerAlan Somers <asomers@gmail.com>2018-11-28 10:47:12 -0700
commitcdf730ca3cdc5ce7dfb284986d39398ac23187b2 (patch)
treee4110799ae4eb5e14dd1881051288dafa624e885 /src/sys/aio.rs
parent3609e6f725e3fe6d830d78bc2d2b36202ea5d790 (diff)
downloadnix-cdf730ca3cdc5ce7dfb284986d39398ac23187b2.zip
Prefer `map(drop)` to `map(|_| ())`
I previously advocated for the latter syntax on stylistic grounds. But it generates less efficient code, because it creates a new lambda function for each usage. The optimizer does not combine them. This change saves about 6KB of code.
Diffstat (limited to 'src/sys/aio.rs')
-rw-r--r--src/sys/aio.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/sys/aio.rs b/src/sys/aio.rs
index 3d539821..c54c2e31 100644
--- a/src/sys/aio.rs
+++ b/src/sys/aio.rs
@@ -1138,7 +1138,7 @@ impl<'a> LioCb<'a> {
let p = self.list.as_ptr();
Errno::result(unsafe {
libc::lio_listio(mode as i32, p, self.list.len() as i32, sigevp)
- }).map(|_| ())
+ }).map(drop)
}
/// Resubmits any incomplete operations with [`lio_listio`].
@@ -1229,7 +1229,7 @@ impl<'a> LioCb<'a> {
let p = self.list.as_ptr();
Errno::result(unsafe {
libc::lio_listio(mode as i32, p, self.list.len() as i32, sigevp)
- }).map(|_| ())
+ }).map(drop)
}
/// Collect final status for an individual `AioCb` submitted as part of an