summaryrefslogtreecommitdiff
path: root/src/console.rs
diff options
context:
space:
mode:
authorTyler Murphy <tylermurphy534@gmail.com>2023-01-28 14:22:29 -0500
committerTyler Murphy <tylermurphy534@gmail.com>2023-01-28 14:22:29 -0500
commit7e07687b5ec14bd788b8d2dd3f0a7ead83842fd4 (patch)
tree795df5d4e91e44e50214437dc0c77f25db66b870 /src/console.rs
parentdocker (diff)
downloadxssbook-7e07687b5ec14bd788b8d2dd3f0a7ead83842fd4.tar.gz
xssbook-7e07687b5ec14bd788b8d2dd3f0a7ead83842fd4.tar.bz2
xssbook-7e07687b5ec14bd788b8d2dd3f0a7ead83842fd4.zip
clippy my beloved
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()