Closed
Description
Version: clippy 0.0.212 (e3cb40e 2019-06-25)
#[derive(Debug)]
struct E {
source: Option<ParseIntError>,
}
impl Error for E {
fn source(&self) -> Option<&(dyn Error + 'static)> {
// Clippy emits `match_as_ref` warning on this `match`
// and suggests using `Option::as_ref()`.
match self.source {
Some(ref s) => Some(s),
None => None,
}
// ^ help: try this: `self.source.as_ref()`
// ... but using `as_ref()` causes E0308: mismatched types.
// self.source.as_ref()
// ^^^^^^^^^^^^^^^^^^^^ expected trait std::error::Error, found struct `std::num::ParseIntError`
//
// = note: expected type `std::option::Option<&(dyn std::error::Error + 'static)>`
// found type `std::option::Option<&std::num::ParseIntError>`
}
}