Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions eyre/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,7 @@ impl Report {
/// The root cause is the last error in the iterator produced by
/// [`chain()`][Report::chain].
pub fn root_cause(&self) -> &(dyn StdError + 'static) {
let mut chain = self.chain();
let mut root_cause = chain.next().unwrap();
for cause in chain {
root_cause = cause;
}
root_cause
self.chain().last().unwrap()
}

/// Returns true if `E` is the type held by this error object.
Expand Down
Loading