1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00

replace let_return as suggested by clippy

See also:
https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
This commit is contained in:
Ben Wiederhake 2025-04-13 03:54:20 +02:00
parent 11cd0b1bbf
commit fc3f7eaa48
2 changed files with 12 additions and 17 deletions

View file

@ -168,21 +168,17 @@ fn execute(
}
fn bytes_from_os_string(input: &OsStr) -> Option<&[u8]> {
let option = {
#[cfg(target_family = "unix")]
{
use std::os::unix::ffi::OsStrExt;
#[cfg(target_family = "unix")]
{
use std::os::unix::ffi::OsStrExt;
Some(input.as_bytes())
}
Some(input.as_bytes())
}
#[cfg(not(target_family = "unix"))]
{
// TODO
// Verify that this works correctly on these platforms
input.to_str().map(|st| st.as_bytes())
}
};
option
#[cfg(not(target_family = "unix"))]
{
// TODO
// Verify that this works correctly on these platforms
input.to_str().map(|st| st.as_bytes())
}
}

View file

@ -283,8 +283,7 @@ impl<'a> NativeStr<'a> {
match &self.native {
Cow::Borrowed(b) => {
let slice = f_borrow(b);
let os_str = slice.map(|x| from_native_int_representation(Cow::Borrowed(x)));
os_str
slice.map(|x| from_native_int_representation(Cow::Borrowed(x)))
}
Cow::Owned(o) => {
let slice = f_owned(o);