mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
uucore: Use next_back on PathBuf's DoubleEndedIterator
As recommended by clippy, last() needlessly goes through the whole path while next_back() is available.
This commit is contained in:
parent
718b1a4ac7
commit
b522f2b9b5
2 changed files with 2 additions and 2 deletions
|
@ -164,7 +164,7 @@ impl ProcessInformation {
|
||||||
let pid = {
|
let pid = {
|
||||||
value
|
value
|
||||||
.iter()
|
.iter()
|
||||||
.last()
|
.next_back()
|
||||||
.ok_or(io::ErrorKind::Other)?
|
.ok_or(io::ErrorKind::Other)?
|
||||||
.to_str()
|
.to_str()
|
||||||
.ok_or(io::ErrorKind::InvalidData)?
|
.ok_or(io::ErrorKind::InvalidData)?
|
||||||
|
|
|
@ -73,7 +73,7 @@ impl TryFrom<PathBuf> for Teletype {
|
||||||
let f = |prefix: &str| {
|
let f = |prefix: &str| {
|
||||||
value
|
value
|
||||||
.iter()
|
.iter()
|
||||||
.last()?
|
.next_back()?
|
||||||
.to_str()?
|
.to_str()?
|
||||||
.strip_prefix(prefix)?
|
.strip_prefix(prefix)?
|
||||||
.parse::<u64>()
|
.parse::<u64>()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue