mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-16 17:03:35 +00:00
For expr return (_ = 42);
unused_paren lint should not be triggered
fixes #131989
This commit is contained in:
parent
3a258d1cf9
commit
33d3c27d38
@ -1063,6 +1063,8 @@ impl UnusedDelimLint for UnusedParens {
|
|||||||
_,
|
_,
|
||||||
_,
|
_,
|
||||||
) if node.is_lazy()))
|
) if node.is_lazy()))
|
||||||
|
&& !(ctx == UnusedDelimsCtx::ReturnValue
|
||||||
|
&& matches!(inner.kind, ast::ExprKind::Assign(_, _, _)))
|
||||||
{
|
{
|
||||||
self.emit_unused_delims_expr(cx, value, ctx, left_pos, right_pos, is_kw)
|
self.emit_unused_delims_expr(cx, value, ctx, left_pos, right_pos, is_kw)
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
//@ check-pass
|
||||||
|
#![warn(unused_parens)]
|
||||||
|
|
||||||
|
fn foo() {
|
||||||
|
return (_ = 42);
|
||||||
|
// lint unused_parens should not be triggered here.
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
Loading…
Reference in New Issue
Block a user