mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +00:00
redundant_closure
This commit is contained in:
parent
b962ae1324
commit
220217af13
@ -132,7 +132,7 @@ pub fn set_file_information_by_handle<T: SetFileInformation>(
|
||||
size: u32,
|
||||
) -> Result<(), WinError> {
|
||||
let result = c::SetFileInformationByHandle(handle, class, info, size);
|
||||
(result != 0).then_some(()).ok_or_else(|| get_last_error())
|
||||
(result != 0).then_some(()).ok_or_else(get_last_error)
|
||||
}
|
||||
// SAFETY: The `SetFileInformation` trait ensures that this is safe.
|
||||
unsafe { set_info(handle, T::CLASS, info.as_ptr(), info.size()) }
|
||||
|
@ -297,7 +297,7 @@ pub fn getenv(k: &OsStr) -> Option<OsString> {
|
||||
let k = to_u16s(k).ok()?;
|
||||
super::fill_utf16_buf(
|
||||
|buf, sz| unsafe { c::GetEnvironmentVariableW(k.as_ptr(), buf, sz) },
|
||||
|buf| OsStringExt::from_wide(buf),
|
||||
OsStringExt::from_wide,
|
||||
)
|
||||
.ok()
|
||||
}
|
||||
@ -356,7 +356,7 @@ pub fn home_dir() -> Option<PathBuf> {
|
||||
crate::env::var_os("HOME")
|
||||
.or_else(|| crate::env::var_os("USERPROFILE"))
|
||||
.map(PathBuf::from)
|
||||
.or_else(|| home_dir_crt())
|
||||
.or_else(home_dir_crt)
|
||||
}
|
||||
|
||||
pub fn exit(code: i32) -> ! {
|
||||
|
@ -245,7 +245,7 @@ impl Command {
|
||||
}
|
||||
|
||||
pub fn get_current_dir(&self) -> Option<&Path> {
|
||||
self.cwd.as_ref().map(|cwd| Path::new(cwd))
|
||||
self.cwd.as_ref().map(Path::new)
|
||||
}
|
||||
|
||||
pub unsafe fn raw_attribute<T: Copy + Send + Sync + 'static>(
|
||||
|
Loading…
Reference in New Issue
Block a user