From ef8a6421c05fe12048a4dc95c8b55b8e25acd9d4 Mon Sep 17 00:00:00 2001 From: Xiaobo Liu Date: Sat, 21 Jun 2025 19:12:08 +0800 Subject: [PATCH] stun: use format! macro instead of string concatenation in Uri display Replace manual string concatenation with format! macro for IPv6 host formatting in Uri::fmt implementation for better readability and performance. Signed-off-by: Xiaobo Liu --- stun/src/uri.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stun/src/uri.rs b/stun/src/uri.rs index 5dce476d9..d87a2f833 100644 --- a/stun/src/uri.rs +++ b/stun/src/uri.rs @@ -21,7 +21,7 @@ pub struct Uri { impl fmt::Display for Uri { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let host = if self.host.contains("::") { - "[".to_owned() + self.host.as_str() + "]" + format!("[{}]", self.host) } else { self.host.clone() };