From 282b368b28f202e5cd138602a06f0a8921afe7aa Mon Sep 17 00:00:00 2001 From: John Eckersberg Date: Thu, 21 Jul 2022 15:52:33 -0400 Subject: [PATCH] nice: Move call to Errno::clear() outside of unsafe block Minor nitpick (of my own previous patch!), Errno::clear() is a safe function, it should not be inside of the unsafe block. --- src/uu/nice/src/nice.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/uu/nice/src/nice.rs b/src/uu/nice/src/nice.rs index f0d663bcc..6fc1d4c3c 100644 --- a/src/uu/nice/src/nice.rs +++ b/src/uu/nice/src/nice.rs @@ -37,10 +37,8 @@ const USAGE: &str = "{} [OPTIONS] [COMMAND [ARGS]]"; pub fn uumain(args: impl uucore::Args) -> UResult<()> { let matches = uu_app().try_get_matches_from(args).with_exit_code(125)?; - let mut niceness = unsafe { - nix::errno::Errno::clear(); - libc::getpriority(PRIO_PROCESS, 0) - }; + nix::errno::Errno::clear(); + let mut niceness = unsafe { libc::getpriority(PRIO_PROCESS, 0) }; if Error::last_os_error().raw_os_error().unwrap() != 0 { return Err(USimpleError::new( 125,