From 970ed610dfa19aa8fbcf83e4ea400edaf4a6c963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20H=C3=B8rl=C3=BCck=20Berg?= <36937807+henrikhorluck@users.noreply.github.com> Date: Mon, 3 Jul 2023 16:42:42 +0200 Subject: [PATCH] Avoid string copying to speed up asan --- fish-rust/src/common.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fish-rust/src/common.rs b/fish-rust/src/common.rs index bda45217b..18cf52e71 100644 --- a/fish-rust/src/common.rs +++ b/fish-rust/src/common.rs @@ -338,7 +338,7 @@ fn escape_string_url(input: &wstr) -> WString { } } // All other chars need to have their UTF-8 representation encoded in hex. - out += &sprintf!("%%%02X"L, byte)[..]; + sprintf!(=> &mut out, "%%%02X"L, byte); } out } @@ -374,7 +374,7 @@ fn escape_string_var(input: &wstr) -> WString { continue; } // All other chars need to have their UTF-8 representation encoded in hex. - out += &sprintf!("_%02X"L, byte)[..]; + sprintf!(=> &mut out, "_%02X"L, byte); prev_was_hex_encoded = true; } if prev_was_hex_encoded {