Skip to content

Commit c597cc6

Browse files
committed
clippy: fix warnings from
double_ended_iterator_last lint
1 parent 1d9347e commit c597cc6

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
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()

0 commit comments

Comments
 (0)