From 4d71a84097b67307dff20f489621b015388cccc6 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 10 Jan 2025 19:35:08 -0800 Subject: [PATCH] Ignore double_ended_iterator_last clippy lint warning: called `Iterator::last` on a `DoubleEndedIterator`; this will needlessly iterate the entire iterator --> src/error.rs:482:22 | 482 | self.chain().last().unwrap() | ^^^^^^ help: try: `next_back()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#double_ended_iterator_last = note: `-W clippy::double-ended-iterator-last` implied by `-W clippy::all` = help: to override `-W clippy::all` add `#[allow(clippy::double_ended_iterator_last)]` --- src/error.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/error.rs b/src/error.rs index cd1f5f5..4c4504b 100644 --- a/src/error.rs +++ b/src/error.rs @@ -478,6 +478,7 @@ impl Error { /// The root cause is the last error in the iterator produced by /// [`chain()`][Error::chain]. #[cfg(any(feature = "std", not(anyhow_no_core_error)))] + #[allow(clippy::double_ended_iterator_last)] pub fn root_cause(&self) -> &(dyn StdError + 'static) { self.chain().last().unwrap() }