We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Debug
&str
1 parent 0334c45 commit 3fda931Copy full SHA for 3fda931
library/core/src/fmt/mod.rs
@@ -2401,6 +2401,11 @@ impl Debug for str {
2401
f.write_char('"')?;
2402
let mut from = 0;
2403
for (i, c) in self.char_indices() {
2404
+ // a fast path for ASCII chars that do not need escapes:
2405
+ if matches!(c, ' '..='~') && !matches!(c, '\\' | '\"') {
2406
+ continue;
2407
+ }
2408
+
2409
let esc = c.escape_debug_ext(EscapeDebugExtArgs {
2410
escape_grapheme_extended: true,
2411
escape_single_quote: false,
0 commit comments