Skip to content

Commit fc3f7ea

Browse files
committed
replace let_return as suggested by clippy
See also: https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
1 parent 11cd0b1 commit fc3f7ea

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

src/uu/echo/src/echo.rs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -168,21 +168,17 @@ fn execute(
168168
}
169169

170170
fn bytes_from_os_string(input: &OsStr) -> Option<&[u8]> {
171-
let option = {
172-
#[cfg(target_family = "unix")]
173-
{
174-
use std::os::unix::ffi::OsStrExt;
171+
#[cfg(target_family = "unix")]
172+
{
173+
use std::os::unix::ffi::OsStrExt;
175174

176-
Some(input.as_bytes())
177-
}
178-
179-
#[cfg(not(target_family = "unix"))]
180-
{
181-
// TODO
182-
// Verify that this works correctly on these platforms
183-
input.to_str().map(|st| st.as_bytes())
184-
}
185-
};
175+
Some(input.as_bytes())
176+
}
186177

187-
option
178+
#[cfg(not(target_family = "unix"))]
179+
{
180+
// TODO
181+
// Verify that this works correctly on these platforms
182+
input.to_str().map(|st| st.as_bytes())
183+
}
188184
}

src/uu/env/src/native_int_str.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,7 @@ impl<'a> NativeStr<'a> {
283283
match &self.native {
284284
Cow::Borrowed(b) => {
285285
let slice = f_borrow(b);
286-
let os_str = slice.map(|x| from_native_int_representation(Cow::Borrowed(x)));
287-
os_str
286+
slice.map(|x| from_native_int_representation(Cow::Borrowed(x)))
288287
}
289288
Cow::Owned(o) => {
290289
let slice = f_owned(o);

0 commit comments

Comments
 (0)