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:
Matthias Krüger
2021-12-19 00:38:41 +01:00
committed by GitHub
4 changed files with 52 additions and 1 deletions

View File

@@ -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),
})
}