mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
Make bool_to_int_with_if
a pedantic lint
In all the cases I've observed, it did not make the code clearer. Using bools as integer is frowned upon in some languages, in others it's simply not possible. You can find comments on the original pull request #8131 that agree with this point of view.
This commit is contained in:
parent
4f1698db60
commit
3790aa3d5d
1 changed files with 2 additions and 2 deletions
|
@ -13,7 +13,7 @@ declare_clippy_lint! {
|
|||
/// this lint suggests using a `from()` function or an `as` coercion.
|
||||
///
|
||||
/// ### Why is this bad?
|
||||
/// Coercion or `from()` is idiomatic way to convert bool to a number.
|
||||
/// Coercion or `from()` is another way to convert bool to a number.
|
||||
/// Both methods are guaranteed to return 1 for true, and 0 for false.
|
||||
///
|
||||
/// See https://doc.rust-lang.org/std/primitive.bool.html#impl-From%3Cbool%3E
|
||||
|
@ -39,7 +39,7 @@ declare_clippy_lint! {
|
|||
/// ```
|
||||
#[clippy::version = "1.65.0"]
|
||||
pub BOOL_TO_INT_WITH_IF,
|
||||
style,
|
||||
pedantic,
|
||||
"using if to convert bool to int"
|
||||
}
|
||||
declare_lint_pass!(BoolToIntWithIf => [BOOL_TO_INT_WITH_IF]);
|
||||
|
|
Loading…
Reference in a new issue