diff --git a/src/uu/who/src/platform/unix.rs b/src/uu/who/src/platform/unix.rs index a91f12fdeb8..6fb70753dd0 100644 --- a/src/uu/who/src/platform/unix.rs +++ b/src/uu/who/src/platform/unix.rs @@ -179,16 +179,14 @@ fn time_string(ut: &UtmpxRecord) -> String { #[inline] fn current_tty() -> String { - unsafe { - let res = ttyname(STDIN_FILENO); - if res.is_null() { - String::new() - } else { - CStr::from_ptr(res.cast_const()) - .to_string_lossy() - .trim_start_matches("/dev/") - .to_owned() - } + let p = unsafe { ttyname(STDIN_FILENO) }; + if p.is_null() { + String::new() + } else { + unsafe { CStr::from_ptr(p) } + .to_string_lossy() + .trim_start_matches("/dev/") + .to_owned() } }