Remove clippy::author attribute from trailing_zeroes test

This commit is contained in:
flip1995 2019-09-27 18:10:18 +02:00
parent b67dfb4896
commit fff6b0e17c
No known key found for this signature in database
GPG Key ID: 693086869D506637
3 changed files with 5 additions and 22 deletions

View File

@ -1,10 +1,8 @@
#![feature(stmt_expr_attributes)]
#![allow(unused_parens)]
fn main() {
let x: i32 = 42;
let _ = #[clippy::author]
(x & 0b1111 == 0); // suggest trailing_zeros
let _ = (x & 0b1111 == 0); // suggest trailing_zeros
let _ = x & 0b1_1111 == 0; // suggest trailing_zeros
let _ = x & 0b1_1010 == 0; // do not lint
let _ = x & 1 == 0; // do not lint

View File

@ -1,13 +1,13 @@
error: bit mask could be simplified with a call to `trailing_zeros`
--> $DIR/trailing_zeros.rs:7:5
--> $DIR/trailing_zeros.rs:5:13
|
LL | (x & 0b1111 == 0); // suggest trailing_zeros
| ^^^^^^^^^^^^^^^^^ help: try: `x.trailing_zeros() >= 4`
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:8:13
--> $DIR/trailing_zeros.rs:6:13
|
LL | let _ = x & 0b1_1111 == 0; // suggest trailing_zeros
| ^^^^^^^^^^^^^^^^^ help: try: `x.trailing_zeros() >= 5`

View File

@ -1,15 +0,0 @@
if_chain! {
if let ExprKind::Binary(ref op, ref left, ref right) = expr.kind;
if BinOpKind::Eq == op.node;
if let ExprKind::Binary(ref op1, ref left1, ref right1) = left.kind;
if BinOpKind::BitAnd == op1.node;
if let ExprKind::Path(ref path) = left1.kind;
if match_qpath(path, &["x"]);
if let ExprKind::Lit(ref lit) = right1.kind;
if let LitKind::Int(15, _) = lit.node;
if let ExprKind::Lit(ref lit1) = right.kind;
if let LitKind::Int(0, _) = lit1.node;
then {
// report your lint here
}
}