summaryrefslogtreecommitdiff
path: root/src/console.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/console.rs')
-rw-r--r--src/console.rs12
1 files changed, 6 insertions, 6 deletions
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<String>, 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::<Value>(&body) else {
@@ -164,7 +164,7 @@ fn beautify(body: String) -> String {
}
let mut writer: Vec<u8> = 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()