asm: When pretty-printing, don't escape characters twice

pprust uses `print_string` to write out the template string, and
`print_string` already calls `escape_debug`, so `impl fmt::Display for
InlineAsmTemplatePiece` shouldn't do an additional `escape_debug`.

This fixes a pretty-printing bug that translated
`asm!("...\n...")`
to
`asm!("...\\n...")`
This commit is contained in:
Josh Triplett 2020-06-14 23:30:28 -07:00
parent 840176ab6f
commit 50d6d4de67

View File

@ -1914,7 +1914,7 @@ impl fmt::Display for InlineAsmTemplatePiece {
match c {
'{' => f.write_str("{{")?,
'}' => f.write_str("}}")?,
_ => write!(f, "{}", c.escape_debug())?,
_ => c.fmt(f)?,
}
}
Ok(())