Skip to content

Commit 221ba2d

Browse files
authored
Rollup merge of #137029 - chenyukang:yukang-fix-unused-check, r=jieyouxu,compiler-errors
Remove unnecessary check code in unused_delims After PR #108297, we make sure there is no unmatched delims in early lint check.
2 parents c133123 + b2197ab commit 221ba2d

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

compiler/rustc_lint/src/unused.rs

-24
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use std::iter;
2-
use std::ops::ControlFlow;
32

43
use rustc_ast as ast;
54
use rustc_ast::util::{classify, parser};
@@ -781,29 +780,6 @@ trait UnusedDelimLint {
781780
right_pos: Option<BytePos>,
782781
is_kw: bool,
783782
) {
784-
// If `value` has `ExprKind::Err`, unused delim lint can be broken.
785-
// For example, the following code caused ICE.
786-
// This is because the `ExprKind::Call` in `value` has `ExprKind::Err` as its argument
787-
// and this leads to wrong spans. #104897
788-
//
789-
// ```
790-
// fn f(){(print!(á
791-
// ```
792-
use rustc_ast::visit::{Visitor, walk_expr};
793-
struct ErrExprVisitor;
794-
impl<'ast> Visitor<'ast> for ErrExprVisitor {
795-
type Result = ControlFlow<()>;
796-
fn visit_expr(&mut self, expr: &'ast ast::Expr) -> ControlFlow<()> {
797-
if let ExprKind::Err(_) = expr.kind {
798-
ControlFlow::Break(())
799-
} else {
800-
walk_expr(self, expr)
801-
}
802-
}
803-
}
804-
if ErrExprVisitor.visit_expr(value).is_break() {
805-
return;
806-
}
807783
let spans = match value.kind {
808784
ast::ExprKind::Block(ref block, None) if let [stmt] = block.stmts.as_slice() => stmt
809785
.span

0 commit comments

Comments
 (0)