Skip to content

Commit 0d1d1ee

Browse files
authored
stun: use format! macro instead of string concatenation in Uri display (#698)
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 <cppcoffee@gmail.com>
1 parent 4327e6e commit 0d1d1ee

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stun/src/uri.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub struct Uri {
2121
impl fmt::Display for Uri {
2222
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2323
let host = if self.host.contains("::") {
24-
"[".to_owned() + self.host.as_str() + "]"
24+
format!("[{}]", self.host)
2525
} else {
2626
self.host.clone()
2727
};

0 commit comments

Comments
 (0)