clippy redundant pattern matching suggestion not compiling #5766
Labels
C-bug
Category: Clippy is not doing the correct thing
I-suggestion-causes-error
Issue: The suggestions provided by this Lint cause an ICE/error when applied
L-suggestion
Lint: Improving, adding or fixing lint suggestions
I ran
cargo clippy
on the following piece of code:Clippy (correctly) detects a redundant pattern matching and (incorrectly) suggests replacing
if let Ok(_) = &s[1..s.len()].parse::<u32>()
withif &s[1..s.len()].parse::<u32>().is_ok()
. But that snippet does not compile if you insert it. It should be replaced withif s[1..s.len()].parse::<u32>().is_ok()
(dropping the reference), that is the correct suggestion.Meta
Tested on
clippy
:0.0.212 (bb37a0f 2020-06-16)
The text was updated successfully, but these errors were encountered: