Change:
Rustc suggests incorrect fixes for #[warn(unusedparens)] for these patterns. No response Rustc version: (the same issue with the stable 1.73.0 rustc). <!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOT_END --
claim

Discussion:
fn check_stmt(&mut self, cx: &EarlyContext<'_>, s: &ast::Stmt) { if let StmtKind::Local(ref local) = s.kind { <del> self.check_unused_parens_pat(cx, &local.pat, true, false, (false, false)); </del> <ins> self.check_unused_parens_pat(cx, &local.pat, true, false, (true, false)); </ins> } <Self as UnusedDelimLint>::check_stmt(self, cx, s)

_a = 0; //~ ERROR unnecessary parentheses around assigned value _a += 1; //~ ERROR unnecessary parentheses around assigned value <ins> let mut _a = 3; //~ ERROR unnecessary parentheses around pattern let mut _a = 3; //~ ERROR unnecessary parentheses around pattern let mut _a = 3; //~ ERROR unnecessary parentheses around pattern let _a = 3; //~ ERROR unnecessary parentheses around pattern let _a = 3; //~ ERROR unnecessary parentheses around pattern let _a = 3; //~ ERROR unnecessary parentheses around pattern </ins> let _a = baz!(3, 4); let _b = baz!(3); }

_a = (0); //~ ERROR unnecessary parentheses around assigned value _a += (1); //~ ERROR unnecessary parentheses around assigned value <ins> let(mut _a) = 3; //~ ERROR unnecessary parentheses around pattern let (mut _a) = 3; //~ ERROR unnecessary parentheses around pattern let( mut _a) = 3; //~ ERROR unnecessary parentheses around pattern let(_a) = 3; //~ ERROR unnecessary parentheses around pattern let (_a) = 3; //~ ERROR unnecessary parentheses around pattern let( _a) = 3; //~ ERROR unnecessary parentheses around pattern </ins> let _a = baz!(3, 4); let _b = baz!(3); }

LL +     _a += 1; | <del> error: aborting due to 22 previous errors </del> <ins> error: unnecessary parentheses around pattern --> $DIR/lint-unnecessary-parens.rs:87:8 | LL |     let(mut _a) = 3; |        ^      ^ | help: remove these parentheses | LL -     let(mut _a) = 3; LL +     let mut _a = 3; | error: unnecessary parentheses around pattern --> $DIR/lint-unnecessary-parens.rs:88:9 | LL |     let (mut _a) = 3; |         ^      ^ | help: remove these parentheses | LL -     let (mut _a) = 3; LL +     let mut _a = 3; | error: unnecessary parentheses around pattern --> $DIR/lint-unnecessary-parens.rs:89:8 | LL |     let( mut _a) = 3; |        ^^      ^ | help: remove these parentheses | LL -     let( mut _a) = 3; LL +     let mut _a = 3; | error: unnecessary parentheses around pattern --> $DIR/lint-unnecessary-parens.rs:91:8 | LL |     let(_a) = 3; |        ^  ^ | help: remove these parentheses | LL -     let(_a) = 3; LL +     let _a = 3; | error: unnecessary parentheses around pattern --> $DIR/lint-unnecessary-parens.rs:92:9 | LL |     let (_a) = 3; |         ^  ^ | help: remove these parentheses | LL -     let (_a) = 3; LL +     let _a = 3; | error: unnecessary parentheses around pattern --> $DIR/lint-unnecessary-parens.rs:93:8 | LL |     let( _a) = 3; |        ^^  ^ | help: remove these parentheses | LL -     let( _a) = 3; LL +     let _a = 3; | error: aborting due to 28 previous errors </ins>