mirror of
https://gitee.com/openharmony/third_party_rust_cxx
synced 2024-11-27 01:11:38 +00:00
Improve formatting of single quote in Debug of CxxString
This commit is contained in:
parent
759a9dddda
commit
0ca09b9b1a
@ -37,7 +37,7 @@ pub fn debug(mut bytes: &[u8], f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let mut written = 0;
|
||||
for (i, ch) in valid.char_indices() {
|
||||
let esc = ch.escape_debug();
|
||||
if esc.len() != 1 {
|
||||
if esc.len() != 1 && ch != '\'' {
|
||||
f.write_str(&valid[written..i])?;
|
||||
for ch in esc {
|
||||
f.write_char(ch)?;
|
||||
|
@ -18,5 +18,5 @@ fn test_async_cxx_string() {
|
||||
fn test_debug() {
|
||||
let_cxx_string!(s = "x\"y\'z");
|
||||
|
||||
assert_eq!(format!("{:?}", s), r#""x\"y\'z""#);
|
||||
assert_eq!(format!("{:?}", s), r#""x\"y'z""#);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user