I have a piece of code which is doing a match on a bool - I find it more readable.
match is_allowed {
true => unverified_piece,
false => original_piece,
}
When I run clippy on this code, I get a message like
help: consider using an if/else expression:
if is_allowed { unverified_piece } else { original_piece }
|
= note: #[warn(match_bool)] on by default
= help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.169/index.html#match_bool
if I add the pragma #[allow(match_bool)]
I get a different message
warning: unknown lint:
match_bool
--> src/movements/piece_keeper.rs:11:17
|
| #[allow(match_bool)]
| ^^^^^^^^^^
|
= note: #[warn(unknown_lints)] on by default
This seems inconsistent which is confusing to me. The only way to get the compiler to stop complaining is to add #[allow(unkown_lints)]
above the match bool pragma.
Is this a mismatch between clippy and compiler? Is there a simpler solution that I've missed?
Thank you!