Rollup merge of #100767 - kadiwa4:escape_ascii, r=jackh726

Remove manual <[u8]>::escape_ascii

`@rustbot` label: +C-cleanup
This commit is contained in:
Dylan DPC
2022-09-12 15:21:30 +05:30
committed by GitHub
7 changed files with 16 additions and 67 deletions

View File

@@ -2633,15 +2633,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 {