Skip to content

Commit 950b40f

Browse files
Don't check match scrutinee of postfix match for unused parens
1 parent 519d892 commit 950b40f

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

compiler/rustc_lint/src/unused.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,9 @@ trait UnusedDelimLint {
865865
(iter, UnusedDelimsCtx::ForIterExpr, true, None, Some(body.span.lo()), true)
866866
}
867867

868-
Match(ref head, ..) if Self::LINT_EXPR_IN_PATTERN_MATCHING_CTX => {
868+
Match(ref head, _, ast::MatchKind::Prefix)
869+
if Self::LINT_EXPR_IN_PATTERN_MATCHING_CTX =>
870+
{
869871
let left = e.span.lo() + rustc_span::BytePos(5);
870872
(head, UnusedDelimsCtx::MatchScrutineeExpr, true, Some(left), None, true)
871873
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//@ check-pass
2+
3+
#![feature(postfix_match)]
4+
5+
fn main() {
6+
(&1).match { a => a };
7+
(1 + 2).match { b => b };
8+
}

0 commit comments

Comments
 (0)