You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
warning: redundant guard
--> src/main.rs:4:14
|
4 | y if y == 100 => {},
| ^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_guards
= note: `#[warn(clippy::redundant_guards)]` on by default
help: try
|
4 - y if y == 100 => {},
4 + 100 => {},
Looks like a false negative then.
From a quick glance, it looks like clippy doesn't consider a path to a const (GeomType::POINT) as an expression that can be a pattern, even though it really could be.
Smaller repro that doesn't emit any warnings, without the bitflags dep:
Note that not all consts can be patterns and the precise semantics are being worked out. rust-lang/lang-team#220 Though in this case I would be surprised if anything stopped a const like this from working as a pattern.
What it does
Prefer matching on the value directly instead of using a guard with equality
Advantage
No response
Drawbacks
No response
Example
Could be written as:
The text was updated successfully, but these errors were encountered: