Skip to content

Commit

Permalink
Appease clippy
Browse files Browse the repository at this point in the history
```
error: called `Iterator::last` on a `DoubleEndedIterator`; this will needlessly iterate the entire iterator
   --> aya/src/programs/uprobe.rs:282:64
    |
282 |             let path = line.split(|b| b.is_ascii_whitespace()).last()?;
    |                                                                ^^^^^^ help: try: `next_back()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#double_ended_iterator_last
```
  • Loading branch information
tamird committed Jan 11, 2025
1 parent 114e7a6 commit 69144a9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion aya/src/programs/uprobe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ fn proc_maps_libs(pid: pid_t) -> Result<Vec<(OsString, PathBuf)>, io::Error> {
}
break;
}
let path = line.split(|b| b.is_ascii_whitespace()).last()?;
let path = line.split(|b| b.is_ascii_whitespace()).next_back()?;
let path = Path::new(OsStr::from_bytes(path));
path.is_absolute()
.then(|| {
Expand Down

0 comments on commit 69144a9

Please sign in to comment.