Use debug_assert.

This commit is contained in:
Stephen Chung
2023-03-23 09:12:48 +08:00
parent 2c94f956e5
commit 3c7cd8e278
7 changed files with 19 additions and 24 deletions

View File

@@ -1219,12 +1219,12 @@ pub fn parse_string_literal(
ch
}
None if verbatim => {
assert_eq!(escape, "", "verbatim strings should not have any escapes");
debug_assert_eq!(escape, "", "verbatim strings should not have any escapes");
pos.advance();
break;
}
None if allow_line_continuation && !escape.is_empty() => {
assert_eq!(escape, "\\", "unexpected escape {escape} at end of line");
debug_assert_eq!(escape, "\\", "unexpected escape {} at end of line", escape);
pos.advance();
break;
}
@@ -1343,14 +1343,14 @@ pub fn parse_string_literal(
// Verbatim
'\n' if verbatim => {
assert_eq!(escape, "", "verbatim strings should not have any escapes");
debug_assert_eq!(escape, "", "verbatim strings should not have any escapes");
pos.new_line();
result.push(next_char);
}
// Line continuation
'\n' if allow_line_continuation && !escape.is_empty() => {
assert_eq!(escape, "\\", "unexpected escape {escape} at end of line");
debug_assert_eq!(escape, "\\", "unexpected escape {} at end of line", escape);
escape.clear();
pos.new_line();