False-positive in redundant_pattern
lint.
#4428
Labels
C-enhancement
Category: Enhancement of lints, like adding more cases or adding help messages
good-first-issue
These issues are a good way to get started with Clippy
L-suggestion
Lint: Improving, adding or fixing lint suggestions
The nightly
slice_patterns
feature (see https://doc.rust-lang.org/nightly/unstable-book/language-features/slice-patterns.html) introduces the syntax..
which matches any leftover elements in the slice, versus the_
for a single item in stable Rust.Clippy's
redundant_pattern
lint checks forvariable @ _
and correctly recommends it be changed to plainvariable
. However, there is (currently) no shorter syntax forvariable @ ..
in patterns, and the recommendation to change it tovariable
is incorrect and changes the meaning. There is also a cosmetic error in that it gives the binding as_
rather than..
.I am using the latest nightly clippy ("clippy 0.0.212 (cd3df6b 2019-08-20)") and this is one example of the cascade of warnings it gives when choking on my parser library:
(In case it's not obvious, this is within a
match { ... }
block.)The desired behaviour is for Clippy is to not treat
..
as equivalent to_
in patterns, because it isn't. Perhaps it was at some point in the evolution of this feature, but it isn't now.The text was updated successfully, but these errors were encountered: