mirror of
https://github.com/uutils/procps.git
synced 2026-06-10 16:14:00 -07:00
clippy: fix warnings from
double_ended_iterator_last lint
This commit is contained in:
@@ -79,7 +79,7 @@ impl TryFrom<PathBuf> for Teletype {
|
||||
let f = |prefix: &str| {
|
||||
value
|
||||
.iter()
|
||||
.last()?
|
||||
.next_back()?
|
||||
.to_str()?
|
||||
.strip_prefix(prefix)?
|
||||
.parse::<u64>()
|
||||
@@ -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)?
|
||||
|
||||
@@ -213,7 +213,7 @@ fn construct_verbose_result(pids: &[u32], action_results: &[Option<ActionResult>
|
||||
|
||||
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();
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user