Rollup merge of #77931 - aticu:fix_60336, r=petrochenkov
Fix false positive for `unused_parens` lint Fixes #60336
This commit is contained in:
commit
378ca5e640
4 changed files with 17 additions and 6 deletions
|
@ -751,13 +751,20 @@ impl UnusedDelimLint for UnusedParens {
|
|||
if !Self::is_expr_delims_necessary(inner, followed_by_block)
|
||||
&& value.attrs.is_empty()
|
||||
&& !value.span.from_expansion()
|
||||
&& (ctx != UnusedDelimsCtx::LetScrutineeExpr
|
||||
|| match inner.kind {
|
||||
ast::ExprKind::Binary(
|
||||
rustc_span::source_map::Spanned { node, .. },
|
||||
_,
|
||||
_,
|
||||
) if node.lazy() => false,
|
||||
_ => true,
|
||||
})
|
||||
{
|
||||
self.emit_unused_delims_expr(cx, value, ctx, left_pos, right_pos)
|
||||
}
|
||||
}
|
||||
ast::ExprKind::Let(_, ref expr) => {
|
||||
// FIXME(#60336): Properly handle `let true = (false && true)`
|
||||
// actually needing the parenthesis.
|
||||
self.check_unused_delims_expr(
|
||||
cx,
|
||||
expr,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue