1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +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:
Nicolas Boichat 2025-05-29 13:53:27 +02:00
parent 718b1a4ac7
commit b522f2b9b5
2 changed files with 2 additions and 2 deletions

View file

@ -164,7 +164,7 @@ impl ProcessInformation {
let pid = {
value
.iter()
.last()
.next_back()
.ok_or(io::ErrorKind::Other)?
.to_str()
.ok_or(io::ErrorKind::InvalidData)?

View file

@ -73,7 +73,7 @@ impl TryFrom<PathBuf> for Teletype {
let f = |prefix: &str| {
value
.iter()
.last()?
.next_back()?
.to_str()?
.strip_prefix(prefix)?
.parse::<u64>()