diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:25 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:25 +0000 |
commit | 5363f350887b1e5b5dd21a86f88c8af9d7fea6da (patch) | |
tree | 35ca005eb6e0e9a1ba3bb5dbc033209ad445dc17 /compiler/rustc_lint/src/hidden_unicode_codepoints.rs | |
parent | Adding debian version 1.66.0+dfsg1-1. (diff) | |
download | rustc-5363f350887b1e5b5dd21a86f88c8af9d7fea6da.tar.xz rustc-5363f350887b1e5b5dd21a86f88c8af9d7fea6da.zip |
Merging upstream version 1.67.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_lint/src/hidden_unicode_codepoints.rs')
-rw-r--r-- | compiler/rustc_lint/src/hidden_unicode_codepoints.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/compiler/rustc_lint/src/hidden_unicode_codepoints.rs b/compiler/rustc_lint/src/hidden_unicode_codepoints.rs index 7e884e990..7106e75db 100644 --- a/compiler/rustc_lint/src/hidden_unicode_codepoints.rs +++ b/compiler/rustc_lint/src/hidden_unicode_codepoints.rs @@ -123,23 +123,22 @@ impl EarlyLintPass for HiddenUnicodeCodepoints { fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &ast::Expr) { // byte strings are already handled well enough by `EscapeError::NonAsciiCharInByteString` - let (text, span, padding) = match &expr.kind { - ast::ExprKind::Lit(ast::Lit { token_lit, kind, span }) => { + match &expr.kind { + ast::ExprKind::Lit(token_lit) => { let text = token_lit.symbol; if !contains_text_flow_control_chars(text.as_str()) { return; } - let padding = match kind { + let padding = match token_lit.kind { // account for `"` or `'` - ast::LitKind::Str(_, ast::StrStyle::Cooked) | ast::LitKind::Char(_) => 1, + ast::token::LitKind::Str | ast::token::LitKind::Char => 1, // account for `r###"` - ast::LitKind::Str(_, ast::StrStyle::Raw(val)) => *val as u32 + 2, + ast::token::LitKind::StrRaw(n) => n as u32 + 2, _ => return, }; - (text, span, padding) + self.lint_text_direction_codepoint(cx, text, expr.span, padding, true, "literal"); } - _ => return, + _ => {} }; - self.lint_text_direction_codepoint(cx, text, *span, padding, true, "literal"); } } |