Skip to content

Commit 3c0ad8a

Browse files
committed
Auto merge of rust-lang#9830 - hrxi:pr_bool_to_int_with_if, r=Manishearth
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 rust-lang#8131 that agree with this point of view. changelog: [`bool_to_int_with_if`]: Change the categorization to pedantic
2 parents 4f1698d + 3790aa3 commit 3c0ad8a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clippy_lints/src/bool_to_int_with_if.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ declare_clippy_lint! {
1313
/// this lint suggests using a `from()` function or an `as` coercion.
1414
///
1515
/// ### Why is this bad?
16-
/// Coercion or `from()` is idiomatic way to convert bool to a number.
16+
/// Coercion or `from()` is another way to convert bool to a number.
1717
/// Both methods are guaranteed to return 1 for true, and 0 for false.
1818
///
1919
/// See https://doc.rust-lang.org/std/primitive.bool.html#impl-From%3Cbool%3E
@@ -39,7 +39,7 @@ declare_clippy_lint! {
3939
/// ```
4040
#[clippy::version = "1.65.0"]
4141
pub BOOL_TO_INT_WITH_IF,
42-
style,
42+
pedantic,
4343
"using if to convert bool to int"
4444
}
4545
declare_lint_pass!(BoolToIntWithIf => [BOOL_TO_INT_WITH_IF]);

0 commit comments

Comments
 (0)