From 77bd9e968efec4792602ac539c99ea642db69825 Mon Sep 17 00:00:00 2001 From: rascul Date: Fri, 15 Mar 2024 21:06:32 -0500 Subject: [PATCH] fmt --- src/lib.rs | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index cf87b86..631a948 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -31,16 +31,13 @@ impl Rear { let error = error.into(); let message = message.into(); - Self { - error, - message, - } + Self { error, message } } } impl Display for Rear { fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult { - if ! self.message.is_empty() { + if !self.message.is_empty() { write!(f, "{}", self.error) } else { write!(f, "{}\n{}", &self.message, &self.error) @@ -50,29 +47,19 @@ impl Display for Rear { impl From> for Rear { fn from(error: Box) -> Self { - Self { - error: error, - message: String::new(), - } + Self { error, message: String::new() } } } impl From for Rear { fn from(error: std::io::Error) -> Self { - Self { - message: error.to_string(), - error: error.into(), - } + Self { message: error.to_string(), error: error.into() } } } #[cfg(feature = "serde_json")] impl From for Rear { fn from(error: serde_json::Error) -> Self { - let message: String = error.to_string(); - Self { - error: error.into(), - message: message, - } + Self { message: error.to_string(), error: error.into() } } }