diff --git a/src/error.rs b/src/error.rs index 7165a64..939e4c6 100644 --- a/src/error.rs +++ b/src/error.rs @@ -180,10 +180,9 @@ impl error::Error for Error { impl error::Error for Transport { fn source(&self) -> Option<&(dyn error::Error + 'static)> { - match &self.source { - Some(s) => Some(s.as_ref()), - None => None, - } + self.source + .as_ref() + .map(|s| s.as_ref() as &(dyn error::Error + 'static)) } } diff --git a/src/stream.rs b/src/stream.rs index 7773fba..fd4b5bd 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -397,11 +397,7 @@ pub(crate) fn connect_host(unit: &Unit, hostname: &str, port: u16) -> Result