From: Jason Ish Date: Fri, 20 Aug 2021 17:03:45 +0000 (-0600) Subject: rust(lint): remove useless format calls X-Git-Tag: suricata-7.0.0-beta1~1521 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8bb6dab69d73e8befdaa9606b7b6b31e0f187abb;p=thirdparty%2Fsuricata.git rust(lint): remove useless format calls In these simple cases to_string() is recommended and likely performs better as the formatter is not called. --- diff --git a/rust/src/ike/logger.rs b/rust/src/ike/logger.rs index b5ee8fdb3a..0a1263b150 100644 --- a/rust/src/ike/logger.rs +++ b/rust/src/ike/logger.rs @@ -29,7 +29,7 @@ fn add_attributes(transform: &Vec, 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 { diff --git a/rust/src/krb/log.rs b/rust/src/krb/log.rs index d0e654b300..e20f36e9b5 100644 --- a/rust/src/krb/log.rs +++ b/rust/src/krb/log.rs @@ -35,7 +35,7 @@ fn krb5_log_response(jsb: &mut JsonBuilder, tx: &mut KRB5Transaction) -> Result< None => "".to_owned(), }; let realm = match tx.realm { - Some(ref x) => format!("{}", x.0), + Some(ref x) => x.0.to_string(), None => "".to_owned(), }; let sname = match tx.sname {