diff options
| author | yukang <moorekang@gmail.com> | 2025-02-14 21:28:15 +0800 |
|---|---|---|
| committer | yukang <moorekang@gmail.com> | 2025-02-15 07:35:28 +0800 |
| commit | b2197abcc6e12d6f39b5622d2a37ff16fd46af61 (patch) | |
| tree | 7699a0e1904a51fdd72fb34413c11b4df236fd1b | |
| parent | a567209daab72b7ea59eac533278064396bb0534 (diff) | |
| download | rust-b2197abcc6e12d6f39b5622d2a37ff16fd46af61.tar.gz rust-b2197abcc6e12d6f39b5622d2a37ff16fd46af61.zip | |
Remove unnecessary check code in unused_delims
| -rw-r--r-- | compiler/rustc_lint/src/unused.rs | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/compiler/rustc_lint/src/unused.rs b/compiler/rustc_lint/src/unused.rs index 5a00ac005db..7b43aac90c7 100644 --- a/compiler/rustc_lint/src/unused.rs +++ b/compiler/rustc_lint/src/unused.rs @@ -1,5 +1,4 @@ use std::iter; -use std::ops::ControlFlow; use rustc_ast as ast; use rustc_ast::util::{classify, parser}; @@ -781,29 +780,6 @@ trait UnusedDelimLint { right_pos: Option<BytePos>, is_kw: bool, ) { - // If `value` has `ExprKind::Err`, unused delim lint can be broken. - // For example, the following code caused ICE. - // This is because the `ExprKind::Call` in `value` has `ExprKind::Err` as its argument - // and this leads to wrong spans. #104897 - // - // ``` - // fn f(){(print!(รก - // ``` - use rustc_ast::visit::{Visitor, walk_expr}; - struct ErrExprVisitor; - impl<'ast> Visitor<'ast> for ErrExprVisitor { - type Result = ControlFlow<()>; - fn visit_expr(&mut self, expr: &'ast ast::Expr) -> ControlFlow<()> { - if let ExprKind::Err(_) = expr.kind { - ControlFlow::Break(()) - } else { - walk_expr(self, expr) - } - } - } - if ErrExprVisitor.visit_expr(value).is_break() { - return; - } let spans = match value.kind { ast::ExprKind::Block(ref block, None) if let [stmt] = block.stmts.as_slice() => stmt .span |
