Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downgrade verbose_bit_mask to pedantic #6036

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clippy_lints/src/bit_mask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ declare_clippy_lint! {
/// if x & 0b1111 == 0 { }
/// ```
pub VERBOSE_BIT_MASK,
style,
pedantic,
"expressions where a bit mask is less readable than the corresponding method call"
}

Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1157,6 +1157,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
store.register_group(true, "clippy::pedantic", Some("clippy_pedantic"), vec![
LintId::of(&attrs::INLINE_ALWAYS),
LintId::of(&await_holding_lock::AWAIT_HOLDING_LOCK),
LintId::of(&bit_mask::VERBOSE_BIT_MASK),
LintId::of(&checked_conversions::CHECKED_CONVERSIONS),
LintId::of(&copies::MATCH_SAME_ARMS),
LintId::of(&copies::SAME_FUNCTIONS_IN_IF_CONDITION),
Expand Down Expand Up @@ -1254,7 +1255,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&attrs::USELESS_ATTRIBUTE),
LintId::of(&bit_mask::BAD_BIT_MASK),
LintId::of(&bit_mask::INEFFECTIVE_BIT_MASK),
LintId::of(&bit_mask::VERBOSE_BIT_MASK),
LintId::of(&blacklisted_name::BLACKLISTED_NAME),
LintId::of(&blocks_in_if_conditions::BLOCKS_IN_IF_CONDITIONS),
LintId::of(&booleans::LOGIC_BUG),
Expand Down Expand Up @@ -1512,7 +1512,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&assign_ops::ASSIGN_OP_PATTERN),
LintId::of(&attrs::BLANKET_CLIPPY_RESTRICTION_LINTS),
LintId::of(&attrs::UNKNOWN_CLIPPY_LINTS),
LintId::of(&bit_mask::VERBOSE_BIT_MASK),
LintId::of(&blacklisted_name::BLACKLISTED_NAME),
LintId::of(&blocks_in_if_conditions::BLOCKS_IN_IF_CONDITIONS),
LintId::of(&collapsible_if::COLLAPSIBLE_IF),
Expand Down
2 changes: 1 addition & 1 deletion src/lintlist/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2637,7 +2637,7 @@ pub static ref ALL_LINTS: Vec<Lint> = vec![
},
Lint {
name: "verbose_bit_mask",
group: "style",
group: "pedantic",
desc: "expressions where a bit mask is less readable than the corresponding method call",
deprecation: None,
module: "bit_mask",
Expand Down
1 change: 1 addition & 0 deletions tests/ui/trailing_zeros.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(unused_parens)]
#![warn(clippy::verbose_bit_mask)]

fn main() {
let x: i32 = 42;
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/trailing_zeros.stderr
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error: bit mask could be simplified with a call to `trailing_zeros`
--> $DIR/trailing_zeros.rs:5:13
--> $DIR/trailing_zeros.rs:6:13
|
LL | let _ = (x & 0b1111 == 0); // suggest trailing_zeros
| ^^^^^^^^^^^^^^^^^ help: try: `x.trailing_zeros() >= 4`
|
= note: `-D clippy::verbose-bit-mask` implied by `-D warnings`

error: bit mask could be simplified with a call to `trailing_zeros`
--> $DIR/trailing_zeros.rs:6:13
--> $DIR/trailing_zeros.rs:7:13
|
LL | let _ = x & 0b1_1111 == 0; // suggest trailing_zeros
| ^^^^^^^^^^^^^^^^^ help: try: `x.trailing_zeros() >= 5`
Expand Down