Skip to content
Myr

Merge pull request #108 from hbina/patch-1

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Simplify code to find root cause

authored by David Tolnay · committed by GitHub · parents 5a19363, 5fa2ac3 · Browse files · 1 file+1 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+1 added−6 removed

  • other:+1 added−6 removed

1 file+1 added−6 removed

modified:src/error.rs+1 added-6 removed
341 unmodified lines
342 /// The root cause is the last error in the iterator produced by343 /// [`chain()`][Error::chain].344 #[cfg(feature = "std")]345 pub fn root_cause(&self) -> &(dyn StdError + 'static) {346 let mut chain = self.chain();347 let mut root_cause = chain.next().unwrap();348 for cause in chain {349 root_cause = cause;350 }351 root_cause346 self.chain().last().unwrap()347 }348349 /// Returns true if `E` is the type held by this error object.350 ///
453 unmodified lines