We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6b6cd47 commit 9748ba7Copy full SHA for 9748ba7
html5ever/src/util/str.rs
@@ -10,13 +10,9 @@
10
use std::fmt;
11
12
pub fn to_escaped_string<T: fmt::Debug>(x: &T) -> String {
13
- use std::fmt::Write;
14
-
15
// FIXME: don't allocate twice
16
- let mut buf = String::new();
17
- let _ = buf.write_fmt(format_args!("{:?}", x));
18
- buf.shrink_to_fit();
19
- buf.chars().flat_map(|c| c.escape_default()).collect()
+ let string = format!("{:?}", x);
+ string.chars().flat_map(|c| c.escape_default()).collect()
20
}
21
22
/// If `c` is an ASCII letter, return the corresponding lowercase
0 commit comments