Refactor common::str::repr using common::escape

This commit is contained in:
Jeong YunWon 2023-05-03 03:25:40 +09:00
parent ae9d3c3193
commit 5b0e92d725
2 changed files with 6 additions and 2 deletions

View file

@ -509,9 +509,10 @@ impl<'a> Unparser<'a> {
if is_spec {
self.unparse_fstring_body(values, is_spec)
} else {
use rustpython_common::escape::Escape;
self.p("f")?;
let body = to_string_fmt(|f| Unparser::new(f).unparse_fstring_body(values, is_spec));
fmt::Display::fmt(&rustpython_common::str::repr(&body), &mut self.f)
rustpython_common::escape::UnicodeEscape::new_repr(&body).write_quoted(&mut self.f)
}
}
}