From 7e07687b5ec14bd788b8d2dd3f0a7ead83842fd4 Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Sat, 28 Jan 2023 14:22:29 -0500 Subject: clippy my beloved --- src/console.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/console.rs') diff --git a/src/console.rs b/src/console.rs index 756bf56..019ae2c 100644 --- a/src/console.rs +++ b/src/console.rs @@ -51,10 +51,10 @@ pub async fn log(ip: IpAddr, method: Method, uri: Uri, path: Option, bod tracing::info!("{} {} {}{} {}", &ip, &method, &path, &uri, &body); let message = LogMessage { - ip: ip, - method: method, - uri: uri, - path: path, + ip, + method, + uri, + path, body: beautify(body) }; @@ -153,7 +153,7 @@ impl Formatter for HtmlFormatter { } fn beautify(body: String) -> String { - if body.len() < 1 { + if body.is_empty() { return "".to_string() } let Ok(mut json) = serde_json::from_str::(&body) else { @@ -164,7 +164,7 @@ fn beautify(body: String) -> String { } let mut writer: Vec = Vec::with_capacity(128); let mut serializer = serde_json::Serializer::with_formatter(&mut writer, HtmlFormatter); - if let Err(_) = json.serialize(&mut serializer) { + if json.serialize(&mut serializer).is_err() { return body } String::from_utf8_lossy(&writer).to_string() -- cgit v1.2.3-freya