Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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‎

Lines changed: 3 additions & 1 deletion
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
}
Lines changed: 8 additions & 0 deletions
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)

AltStyle によって変換されたページ (->オリジナル) /