From 8bb6dab69d73e8befdaa9606b7b6b31e0f187abb Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Fri, 20 Aug 2021 11:03:45 -0600 Subject: [PATCH] rust(lint): remove useless format calls In these simple cases to_string() is recommended and likely performs better as the formatter is not called. --- rust/src/ike/logger.rs | 2 +- rust/src/krb/log.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 {