Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion compiler/rustc_lint/src/unused.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,11 @@ trait UnusedDelimLint {

lhs_needs_parens
|| (followed_by_block
&& match inner.kind {
&& match &inner.kind {
ExprKind::Ret(_) | ExprKind::Break(..) | ExprKind::Yield(..) => true,
ExprKind::Range(_lhs, Some(rhs), _limits) => {
!classify::expr_requires_semi_to_be_stmt(&rhs)
}
_ => parser::contains_exterior_struct_lit(&inner),
})
}
Expand Down
8 changes: 8 additions & 0 deletions src/test/ui/lint/unused/issue-90807-unused-paren.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// check-pass
// Make sure unused parens lint doesn't emit a false positive.
// See https://github.com/rust-lang/rust/issues/90807
#![deny(unused_parens)]

fn main() {
for _ in (1..{ 2 }) {}
}