Identify impossible cases in ascii_escapes_should_be_ascii.

Raw strings (of all kinds) don't support escapes, so this function
should never be called on them.
This commit is contained in:
Nicholas Nethercote 2023-12-06 20:37:02 +11:00
parent 856b55fb34
commit e290582abf

View File

@ -169,8 +169,9 @@ pub fn in_double_quotes(self) -> bool {
/// Non-byte literals should have `\xXX` escapes that are within the ASCII range. /// Non-byte literals should have `\xXX` escapes that are within the ASCII range.
fn ascii_escapes_should_be_ascii(self) -> bool { fn ascii_escapes_should_be_ascii(self) -> bool {
match self { match self {
Mode::Char | Mode::Str | Mode::RawStr => true, Mode::Char | Mode::Str => true,
Mode::Byte | Mode::ByteStr | Mode::RawByteStr | Mode::CStr | Mode::RawCStr => false, Mode::Byte | Mode::ByteStr | Mode::CStr => false,
Mode::RawStr | Mode::RawByteStr | Mode::RawCStr => unreachable!(),
} }
} }