Don't check match scrutinee of postfix match for unused parens
This commit is contained in:
parent
519d892f95
commit
950b40f111
2 changed files with 11 additions and 1 deletions
|
@ -865,7 +865,9 @@ trait UnusedDelimLint {
|
||||||
(iter, UnusedDelimsCtx::ForIterExpr, true, None, Some(body.span.lo()), true)
|
(iter, UnusedDelimsCtx::ForIterExpr, true, None, Some(body.span.lo()), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
Match(ref head, ..) if Self::LINT_EXPR_IN_PATTERN_MATCHING_CTX => {
|
Match(ref head, _, ast::MatchKind::Prefix)
|
||||||
|
if Self::LINT_EXPR_IN_PATTERN_MATCHING_CTX =>
|
||||||
|
{
|
||||||
let left = e.span.lo() + rustc_span::BytePos(5);
|
let left = e.span.lo() + rustc_span::BytePos(5);
|
||||||
(head, UnusedDelimsCtx::MatchScrutineeExpr, true, Some(left), None, true)
|
(head, UnusedDelimsCtx::MatchScrutineeExpr, true, Some(left), None, true)
|
||||||
}
|
}
|
||||||
|
|
8
tests/ui/match/postfix-match/no-unused-parens.rs
Normal file
8
tests/ui/match/postfix-match/no-unused-parens.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
//@ check-pass
|
||||||
|
|
||||||
|
#![feature(postfix_match)]
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
(&1).match { a => a };
|
||||||
|
(1 + 2).match { b => b };
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue