X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_lint%2Fsrc%2Fhidden_unicode_codepoints.rs;h=7106e75dba290ebcac26a9deac25964eff0afaec;hb=5726f1f3ac9e8f1cd3a54c6631f64b7f1ddc14d1;hp=7e884e990ce35b084efa388271cb40d4bccf4491;hpb=f42b6fa7cad0d221b0c5407dca70b085784b1b5e;p=rust.git diff --git a/compiler/rustc_lint/src/hidden_unicode_codepoints.rs b/compiler/rustc_lint/src/hidden_unicode_codepoints.rs index 7e884e990ce..7106e75dba2 100644 --- a/compiler/rustc_lint/src/hidden_unicode_codepoints.rs +++ b/compiler/rustc_lint/src/hidden_unicode_codepoints.rs @@ -123,23 +123,22 @@ fn check_attribute(&mut self, cx: &EarlyContext<'_>, attr: &ast::Attribute) { 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"); } }