From 69144a977ef33613610f0f7b9a94e432da3a2d59 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Sat, 11 Jan 2025 08:38:14 -0500 Subject: [PATCH] Appease clippy ``` 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 ``` --- aya/src/programs/uprobe.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aya/src/programs/uprobe.rs b/aya/src/programs/uprobe.rs index 21f721ac..944ceadd 100644 --- a/aya/src/programs/uprobe.rs +++ b/aya/src/programs/uprobe.rs @@ -279,7 +279,7 @@ fn proc_maps_libs(pid: pid_t) -> Result, 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(|| {