Skip to content

Commit

Permalink
Ignore double_ended_iterator_last clippy lint
Browse files Browse the repository at this point in the history
    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)]`
  • Loading branch information
dtolnay committed Jan 11, 2025
1 parent af0937e commit 4d71a84
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down

0 comments on commit 4d71a84

Please # to comment.