Use drop instead of the toilet closure |_| ()
This commit is contained in:
@@ -923,6 +923,6 @@ fn symlink_junction_inner(target: &Path, junction: &Path) -> io::Result<()> {
|
||||
&mut ret,
|
||||
ptr::null_mut(),
|
||||
))
|
||||
.map(|_| ())
|
||||
.map(drop)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ impl RawHandle {
|
||||
}
|
||||
|
||||
pub fn cancel_io(&self) -> io::Result<()> {
|
||||
unsafe { cvt(c::CancelIo(self.raw())).map(|_| ()) }
|
||||
unsafe { cvt(c::CancelIo(self.raw())).map(drop) }
|
||||
}
|
||||
|
||||
pub fn write(&self, buf: &[u8]) -> io::Result<usize> {
|
||||
|
||||
@@ -355,7 +355,7 @@ impl Socket {
|
||||
#[cfg(not(target_vendor = "uwp"))]
|
||||
fn set_no_inherit(&self) -> io::Result<()> {
|
||||
sys::cvt(unsafe { c::SetHandleInformation(self.0 as c::HANDLE, c::HANDLE_FLAG_INHERIT, 0) })
|
||||
.map(|_| ())
|
||||
.map(drop)
|
||||
}
|
||||
|
||||
#[cfg(target_vendor = "uwp")]
|
||||
|
||||
@@ -247,7 +247,7 @@ pub fn chdir(p: &path::Path) -> io::Result<()> {
|
||||
let mut p = p.encode_wide().collect::<Vec<_>>();
|
||||
p.push(0);
|
||||
|
||||
cvt(unsafe { c::SetCurrentDirectoryW(p.as_ptr()) }).map(|_| ())
|
||||
cvt(unsafe { c::SetCurrentDirectoryW(p.as_ptr()) }).map(drop)
|
||||
}
|
||||
|
||||
pub fn getenv(k: &OsStr) -> io::Result<Option<OsString>> {
|
||||
@@ -272,12 +272,12 @@ pub fn setenv(k: &OsStr, v: &OsStr) -> io::Result<()> {
|
||||
let k = to_u16s(k)?;
|
||||
let v = to_u16s(v)?;
|
||||
|
||||
cvt(unsafe { c::SetEnvironmentVariableW(k.as_ptr(), v.as_ptr()) }).map(|_| ())
|
||||
cvt(unsafe { c::SetEnvironmentVariableW(k.as_ptr(), v.as_ptr()) }).map(drop)
|
||||
}
|
||||
|
||||
pub fn unsetenv(n: &OsStr) -> io::Result<()> {
|
||||
let v = to_u16s(n)?;
|
||||
cvt(unsafe { c::SetEnvironmentVariableW(v.as_ptr(), ptr::null()) }).map(|_| ())
|
||||
cvt(unsafe { c::SetEnvironmentVariableW(v.as_ptr(), ptr::null()) }).map(drop)
|
||||
}
|
||||
|
||||
pub fn temp_dir() -> PathBuf {
|
||||
|
||||
Reference in New Issue
Block a user