-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have
Description
Repro:
# .clippy.toml
msrv = "1.31.0"
// src/main.rs
#![deny(clippy::pedantic)]
enum E {
A,
#[allow(dead_code)]
B,
}
fn main() {
match E::A {
e @ E::A | e @ E::B => {
let _ = e;
}
}
match E::A {
e @ (E::A | E::B) => {
let _ = e;
}
}
}
cargo clippy
emits a unnested_or_patterns lint, despite that syntax not being valid on Rust 1.31.0.
error: unnested or-patterns
--> src/main.rs:11:9
|
11 | e @ E::A | e @ E::B => {
| ^^^^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> src/main.rs:1:9
|
1 | #![deny(clippy::pedantic)]
| ^^^^^^^^^^^^^^^^
= note: `#[deny(clippy::unnested_or_patterns)]` implied by `#[deny(clippy::pedantic)]`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnested_or_patterns
help: nest the patterns
|
11 | e @ (E::A | E::B) => {
| ^^^^^^^^^^^^^^^^^
The suggested replacement on Rust 1.31.0:
$ cargo +1.31.0 check
error: expected one of `)`, `,`, or `::`, found `|`
--> src/main.rs:11:19
|
11 | e @ (E::A | E::B) => {
| ^ expected one of `)`, `,`, or `::` here
Meta
cargo clippy -V
: clippy 0.1.52 (5d04957 2021-03-22)rustc -Vv
:rustc 1.53.0-nightly (5d04957a4 2021-03-22) binary: rustc commit-hash: 5d04957a4b4714f71d38326fc96a0b0ef6dc5800 commit-date: 2021-03-22 host: x86_64-unknown-linux-gnu release: 1.53.0-nightly LLVM version: 12.0.0
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have