fixed filter() and filter_map() calls

This commit is contained in:
Harald Hoyer 2019-01-26 10:23:00 +01:00
parent d14af67560
commit e7d4afb86c
2 changed files with 3 additions and 3 deletions

View file

@ -1,6 +1,6 @@
[package] [package]
name = "chainerror" name = "chainerror"
version = "0.4.1" version = "0.4.2"
authors = ["Harald Hoyer <harald@redhat.com>"] authors = ["Harald Hoyer <harald@redhat.com>"]
edition = "2018" edition = "2018"
license = "MIT/Apache-2.0" license = "MIT/Apache-2.0"

View file

@ -266,7 +266,7 @@ impl<T: 'static + Display + Debug> ChainError<T> {
~~~ ~~~
**/ **/
pub fn find_cause<U: Error + 'static>(&self) -> Option<&U> { pub fn find_cause<U: Error + 'static>(&self) -> Option<&U> {
self.iter().filter_map(Error::downcast_ref::<U>()).next() self.iter().filter_map(Error::downcast_ref::<U>).next()
} }
/** find the first error cause of type ChainError<U>, if any exists /** find the first error cause of type ChainError<U>, if any exists
@ -286,7 +286,7 @@ impl<T: 'static + Display + Debug> ChainError<T> {
**/ **/
pub fn find_chain_cause<U: Error + 'static>(&self) -> Option<&ChainError<U>> { pub fn find_chain_cause<U: Error + 'static>(&self) -> Option<&ChainError<U>> {
self.iter() self.iter()
.filter_map(Error::downcast_ref::<ChainError<U>>()) .filter_map(Error::downcast_ref::<ChainError<U>>)
.next() .next()
} }