diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-08-04 22:25:02 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-04 22:25:02 +0200 |
| commit | 6b938c8491bc8d16a9a1a4d080368485f4454d31 (patch) | |
| tree | 3b64e51f9b87427d80439f52038e85cecaf74fce /compiler/rustc_lint/src | |
| parent | d3aa757ff8244f83a7dfe4995fe5d2da78399252 (diff) | |
| parent | 8dd44f1af4ac49331d0998eebae21d54b0ab5bde (diff) | |
| download | rust-6b938c8491bc8d16a9a1a4d080368485f4454d31.tar.gz rust-6b938c8491bc8d16a9a1a4d080368485f4454d31.zip | |
Rollup merge of #100093 - wcampbell0x2a:unused-parens-for-match-arms, r=petrochenkov
Enable unused_parens for match arms Fixes: https://github.com/rust-lang/rust/issues/92751 Currently I can't get the `stderr` to work with `./x.py test`, but this should fix the issue. Help would be appreciated!
Diffstat (limited to 'compiler/rustc_lint/src')
| -rw-r--r-- | compiler/rustc_lint/src/unused.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler/rustc_lint/src/unused.rs b/compiler/rustc_lint/src/unused.rs index 53269d18527..b6cf182916c 100644 --- a/compiler/rustc_lint/src/unused.rs +++ b/compiler/rustc_lint/src/unused.rs @@ -396,6 +396,7 @@ enum UnusedDelimsCtx { LetScrutineeExpr, ArrayLenExpr, AnonConst, + MatchArmExpr, } impl From<UnusedDelimsCtx> for &'static str { @@ -414,6 +415,7 @@ impl From<UnusedDelimsCtx> for &'static str { UnusedDelimsCtx::BlockRetValue => "block return value", UnusedDelimsCtx::LetScrutineeExpr => "`let` scrutinee expression", UnusedDelimsCtx::ArrayLenExpr | UnusedDelimsCtx::AnonConst => "const expression", + UnusedDelimsCtx::MatchArmExpr => "match arm expression", } } } @@ -805,6 +807,18 @@ impl EarlyLintPass for UnusedParens { } return; } + ExprKind::Match(ref _expr, ref arm) => { + for a in arm { + self.check_unused_delims_expr( + cx, + &a.body, + UnusedDelimsCtx::MatchArmExpr, + false, + None, + None, + ); + } + } _ => {} } |
