]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust(lint): remove useless format calls
authorJason Ish <jason.ish@oisf.net>
Fri, 20 Aug 2021 17:03:45 +0000 (11:03 -0600)
committerVictor Julien <victor@inliniac.net>
Mon, 23 Aug 2021 08:03:12 +0000 (10:03 +0200)
In these simple cases to_string() is recommended and likely
performs better as the formatter is not called.

rust/src/ike/logger.rs
rust/src/krb/log.rs

index b5ee8fdb3a80e20cea2e128753125796c236edc9..0a1263b15025000e60417fc6d336c039eb250170 100644 (file)
@@ -29,7 +29,7 @@ fn add_attributes(transform: &Vec<SaAttribute>, js: &mut JsonBuilder) -> Result<
     for attribute in transform {
         js.set_string(
             attribute.attribute_type.to_string().as_str(),
-            format!("{}", attribute.attribute_value.to_string()).as_str(),
+            attribute.attribute_value.to_string().as_str(),
         )?;
 
         if let Some(numeric_value) = attribute.numeric_value {
index d0e654b3003853354e514a5c0b19b39744d94bbc..e20f36e9b5b37f041a79b6bb1b8a4308a4b663d2 100644 (file)
@@ -35,7 +35,7 @@ fn krb5_log_response(jsb: &mut JsonBuilder, tx: &mut KRB5Transaction) -> Result<
         None        => "<empty>".to_owned(),
     };
     let realm = match tx.realm {
-        Some(ref x) => format!("{}", x.0),
+        Some(ref x) => x.0.to_string(),
         None        => "<empty>".to_owned(),
     };
     let sname = match tx.sname {