fix: clippy

Signed-off-by: Harald Hoyer <harald@hoyer.xyz>
This commit is contained in:
Harald Hoyer 2023-07-27 12:39:31 +02:00
parent 05085229be
commit d60cdf9cdb
Signed by: harald
GPG key ID: 900F3C4971086004
7 changed files with 14 additions and 13 deletions

View file

@ -103,7 +103,6 @@
//! Read the [Tutorial](https://haraldh.github.io/chainerror/tutorial1.html)
#![deny(clippy::all)]
#![deny(clippy::integer_arithmetic)]
#![allow(clippy::needless_doctest_main)]
#![deny(missing_docs)]
@ -198,7 +197,9 @@ impl<T: 'static + Display + Debug> ChainError<T> {
/// ```
#[inline]
pub fn find_cause<U: Error + 'static>(&self) -> Option<&U> {
self.iter().filter_map(Error::downcast_ref::<U>).next()
self.iter()
.filter_map(<dyn Error>::downcast_ref::<U>)
.next()
}
/// Find the first error cause of type `ChainError<U>`, if any exists
@ -220,7 +221,7 @@ impl<T: 'static + Display + Debug> ChainError<T> {
#[inline]
pub fn find_chain_cause<U: Error + 'static>(&self) -> Option<&ChainError<U>> {
self.iter()
.filter_map(Error::downcast_ref::<ChainError<U>>)
.filter_map(<dyn Error>::downcast_ref::<ChainError<U>>)
.next()
}
@ -428,7 +429,7 @@ impl<U: 'static + Display + Debug> ChainErrorDown for ChainError<U> {
#[allow(clippy::cast_ptr_alignment)]
unsafe {
#[allow(trivial_casts)]
Some(&*(self as *const dyn Error as *const &ChainError<T>))
Some(*(self as *const dyn Error as *const &ChainError<T>))
}
} else {
None