From 7651d4d3fcb3892024224595b620bb6891ceb678 Mon Sep 17 00:00:00 2001 From: Alex Lyon Date: Sun, 28 Apr 2019 19:55:18 -0700 Subject: [PATCH] Get rid of all warnings on Linux (or at least WSL) --- src/uucore/mode.rs | 2 +- src/who/who.rs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/uucore/mode.rs b/src/uucore/mode.rs index 7a08652db..26e237a7b 100644 --- a/src/uucore/mode.rs +++ b/src/uucore/mode.rs @@ -10,7 +10,7 @@ use std::error::Error; pub fn parse_numeric(fperm: u32, mut mode: &str) -> Result { let (op, pos) = parse_op(mode, Some('='))?; - mode = mode[pos..].trim_left_matches('0'); + mode = mode[pos..].trim_start_matches('0'); if mode.len() > 4 { Err(format!("mode is too large ({} > 7777)", mode)) } else { diff --git a/src/who/who.rs b/src/who/who.rs index c9b5b86aa..99f0cb9a0 100644 --- a/src/who/who.rs +++ b/src/who/who.rs @@ -282,7 +282,7 @@ fn current_tty() -> String { if !res.is_null() { CStr::from_ptr(res as *const _) .to_string_lossy() - .trim_left_matches("/dev/") + .trim_start_matches("/dev/") .to_owned() } else { "".to_owned() @@ -293,7 +293,9 @@ fn current_tty() -> String { impl Who { fn exec(&mut self) { let run_level_chk = |record: i16| { + #[allow(unused_assignments)] let mut res = false; + #[cfg(any(target_os = "macos", target_os = "ios", target_os = "linux", target_os = "android"))] { res = record == utmpx::RUN_LVL; @@ -520,7 +522,7 @@ impl Who { if self.include_exit { buf.push_str(&format!(" {:<12}", exit)); } - println!("{}", buf.trim_right()); + println!("{}", buf.trim_end()); } #[inline]