From 25a9ac61c33751bfb60d49f86e745fd2b9064a8d Mon Sep 17 00:00:00 2001 From: "Victor M. Alvarez" Date: Fri, 2 Aug 2024 18:24:03 +0200 Subject: [PATCH] style: fix clippy warnings --- cli/src/commands/scan.rs | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/cli/src/commands/scan.rs b/cli/src/commands/scan.rs index 4552f0c20..e21ca5106 100644 --- a/cli/src/commands/scan.rs +++ b/cli/src/commands/scan.rs @@ -417,22 +417,19 @@ fn print_rules_as_json( "data": s.as_str() }); - match m.xor_key() { - Some(k) => { - let mut p = String::with_capacity(s.len()); - for b in - &match_data[..min(match_data.len(), *limit)] - { - for c in (b ^ k).escape_ascii() { - p.push_str( - format!("{}", c as char).as_str(), - ); - } + if let Some(k) = m.xor_key() { + let mut p = String::with_capacity(s.len()); + for b in + &match_data[..min(match_data.len(), *limit)] + { + for c in (b ^ k).escape_ascii() { + p.push_str( + format!("{}", c as char).as_str(), + ); } - match_json["xor_key"] = serde_json::json!(k); - match_json["plaintext"] = serde_json::json!(p); } - _ => {} + match_json["xor_key"] = serde_json::json!(k); + match_json["plaintext"] = serde_json::json!(p); } match_vec.push(match_json); @@ -536,10 +533,10 @@ fn print_rules_as_text( ); } } - msg.push_str(format!("): ").as_str()); + msg.push_str("): "); } _ => { - msg.push_str(format!(": ").as_str()); + msg.push_str(": "); } }