Rollup merge of #91956 - notriddle:notriddle/unused-parens-range, r=nagisa
fix(rustc_lint): better detect when parens are necessary Fixes #90807
This commit is contained in:
commit
48915315d2
4 changed files with 52 additions and 1 deletions
|
@ -478,8 +478,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) => {
|
||||
matches!(rhs.kind, ExprKind::Block(..))
|
||||
}
|
||||
_ => parser::contains_exterior_struct_lit(&inner),
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue