Skip to content

Commit b74e85a

Browse files
Merge pull request #386 from cakebaker/clippy_fix_warnings_from_rust_1_86
clippy: fix warnings from Rust 1.86
2 parents 7055130 + c597cc6 commit b74e85a

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

src/uu/pgrep/src/process.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl TryFrom<PathBuf> for Teletype {
7979
let f = |prefix: &str| {
8080
value
8181
.iter()
82-
.last()?
82+
.next_back()?
8383
.to_str()?
8484
.strip_prefix(prefix)?
8585
.parse::<u64>()
@@ -229,7 +229,7 @@ impl ProcessInformation {
229229
let pid = {
230230
value
231231
.iter()
232-
.last()
232+
.next_back()
233233
.ok_or(io::ErrorKind::Other)?
234234
.to_str()
235235
.ok_or(io::ErrorKind::InvalidData)?

src/uu/snice/src/snice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ fn construct_verbose_result(pids: &[u32], action_results: &[Option<ActionResult>
213213

214214
let mut cmd = process
215215
.exe()
216-
.and_then(|it| it.iter().last())
216+
.and_then(|it| it.iter().next_back())
217217
.unwrap_or("?".as_ref());
218218
let cmd = cmd.to_str().unwrap();
219219

src/uu/top/src/picker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ fn command(pid: u32) -> String {
193193
};
194194

195195
proc.exe()
196-
.and_then(|it| it.iter().last())
196+
.and_then(|it| it.iter().next_back())
197197
.map(|it| it.to_str().unwrap())
198198
.unwrap_or(&f(proc.cmd()))
199199
.into()

src/uu/top/src/top.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ where
154154
input.chars().take(width).collect()
155155
} else {
156156
let mut result = String::from(&input);
157-
result.extend(std::iter::repeat(' ').take(width - input.len()));
157+
result.extend(std::iter::repeat_n(' ', width - input.len()));
158158
result
159159
}
160160
}

tests/common/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,9 +1186,9 @@ impl TestScenario {
11861186

11871187
/// A `UCommand` is a builder wrapping an individual Command that provides several additional features:
11881188
/// 1. it has convenience functions that are more ergonomic to use for piping in stdin, spawning the command
1189-
/// and asserting on the results.
1189+
/// and asserting on the results.
11901190
/// 2. it tracks arguments provided so that in test cases which may provide variations of an arg in loops
1191-
/// the test failure can display the exact call which preceded an assertion failure.
1191+
/// the test failure can display the exact call which preceded an assertion failure.
11921192
/// 3. it provides convenience construction methods to set the Command uutils utility and temporary directory.
11931193
///
11941194
/// Per default `UCommand` runs a command given as an argument in a shell, platform independently.

0 commit comments

Comments
 (0)