Skip to content

Commit ddda954

Browse files
committedOct 15, 2024
Auto merge of rust-lang#13553 - SpriteOvO:manual_is_power_of_two-change-category, r=llogiq
Change the category of `manual_is_power_of_two` to `pedantic` Fixes rust-lang#13547. The value being checked might be a bit flag, suggesting `is_power_of_two` for it would make the code unreadable. changelog: [`manual_is_power_of_two`]: Change the category to `pedantic`

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed
 

‎clippy_lints/src/manual_is_power_of_two.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ use rustc_session::declare_lint_pass;
1111

1212
declare_clippy_lint! {
1313
/// ### What it does
14-
/// Checks for expressions like `x.count_ones() == 1` or `x & (x - 1) == 0`, with x and unsigned integer, which are manual
14+
/// Checks for expressions like `x.count_ones() == 1` or `x & (x - 1) == 0`, with x and unsigned integer, which may be manual
1515
/// reimplementations of `x.is_power_of_two()`.
16+
///
1617
/// ### Why is this bad?
1718
/// Manual reimplementations of `is_power_of_two` increase code complexity for little benefit.
19+
///
1820
/// ### Example
1921
/// ```no_run
2022
/// let a: u32 = 4;
@@ -27,7 +29,7 @@ declare_clippy_lint! {
2729
/// ```
2830
#[clippy::version = "1.82.0"]
2931
pub MANUAL_IS_POWER_OF_TWO,
30-
complexity,
32+
pedantic,
3133
"manually reimplementing `is_power_of_two`"
3234
}
3335

0 commit comments

Comments
 (0)
Please sign in to comment.