use <[u8]>::escape_ascii instead of core::ascii::escape_default
This commit is contained in:
@@ -2643,15 +2643,7 @@ fn pretty_print_const<'tcx>(
|
||||
}
|
||||
|
||||
fn pretty_print_byte_str(fmt: &mut Formatter<'_>, byte_str: &[u8]) -> fmt::Result {
|
||||
fmt.write_str("b\"")?;
|
||||
for &c in byte_str {
|
||||
for e in std::ascii::escape_default(c) {
|
||||
fmt.write_char(e as char)?;
|
||||
}
|
||||
}
|
||||
fmt.write_str("\"")?;
|
||||
|
||||
Ok(())
|
||||
write!(fmt, "b\"{}\"", byte_str.escape_ascii())
|
||||
}
|
||||
|
||||
fn comma_sep<'tcx>(fmt: &mut Formatter<'_>, elems: Vec<ConstantKind<'tcx>>) -> fmt::Result {
|
||||
|
||||
@@ -1401,14 +1401,7 @@ pub trait PrettyPrinter<'tcx>:
|
||||
}
|
||||
|
||||
fn pretty_print_byte_str(mut self, byte_str: &'tcx [u8]) -> Result<Self::Const, Self::Error> {
|
||||
define_scoped_cx!(self);
|
||||
p!("b\"");
|
||||
for &c in byte_str {
|
||||
for e in std::ascii::escape_default(c) {
|
||||
self.write_char(e as char)?;
|
||||
}
|
||||
}
|
||||
p!("\"");
|
||||
write!(self, "b\"{}\"", byte_str.escape_ascii())?;
|
||||
Ok(self)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user