diff --git a/src/uu/pgrep/src/process.rs b/src/uu/pgrep/src/process.rs index 50521b2..91b8a3b 100644 --- a/src/uu/pgrep/src/process.rs +++ b/src/uu/pgrep/src/process.rs @@ -79,7 +79,7 @@ impl TryFrom for Teletype { let f = |prefix: &str| { value .iter() - .last()? + .next_back()? .to_str()? .strip_prefix(prefix)? .parse::() @@ -229,7 +229,7 @@ impl ProcessInformation { let pid = { value .iter() - .last() + .next_back() .ok_or(io::ErrorKind::Other)? .to_str() .ok_or(io::ErrorKind::InvalidData)? diff --git a/src/uu/snice/src/snice.rs b/src/uu/snice/src/snice.rs index 8a6af84..f9a8e6b 100644 --- a/src/uu/snice/src/snice.rs +++ b/src/uu/snice/src/snice.rs @@ -213,7 +213,7 @@ fn construct_verbose_result(pids: &[u32], action_results: &[Option let mut cmd = process .exe() - .and_then(|it| it.iter().last()) + .and_then(|it| it.iter().next_back()) .unwrap_or("?".as_ref()); let cmd = cmd.to_str().unwrap(); diff --git a/src/uu/top/src/picker.rs b/src/uu/top/src/picker.rs index f103e9b..beae924 100644 --- a/src/uu/top/src/picker.rs +++ b/src/uu/top/src/picker.rs @@ -193,7 +193,7 @@ fn command(pid: u32) -> String { }; proc.exe() - .and_then(|it| it.iter().last()) + .and_then(|it| it.iter().next_back()) .map(|it| it.to_str().unwrap()) .unwrap_or(&f(proc.cmd())) .into() diff --git a/src/uu/top/src/top.rs b/src/uu/top/src/top.rs index 885ebd1..a182000 100644 --- a/src/uu/top/src/top.rs +++ b/src/uu/top/src/top.rs @@ -154,7 +154,7 @@ where input.chars().take(width).collect() } else { let mut result = String::from(&input); - result.extend(std::iter::repeat(' ').take(width - input.len())); + result.extend(std::iter::repeat_n(' ', width - input.len())); result } } diff --git a/tests/common/util.rs b/tests/common/util.rs index cfd914f..a269d87 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -1186,9 +1186,9 @@ impl TestScenario { /// A `UCommand` is a builder wrapping an individual Command that provides several additional features: /// 1. it has convenience functions that are more ergonomic to use for piping in stdin, spawning the command -/// and asserting on the results. +/// and asserting on the results. /// 2. it tracks arguments provided so that in test cases which may provide variations of an arg in loops -/// the test failure can display the exact call which preceded an assertion failure. +/// the test failure can display the exact call which preceded an assertion failure. /// 3. it provides convenience construction methods to set the Command uutils utility and temporary directory. /// /// Per default `UCommand` runs a command given as an argument in a shell, platform independently.