Skip to content

Commit b4618f9

Browse files
committed
Fix failing tests
1 parent 05fe342 commit b4618f9

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

clippy_lints/src/xor_used_as_pow.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl LateLintPass<'_> for XorUsedAsPow {
5555
if let ExprKind::Binary(op, left, right) = &expr.kind;
5656
if BinOpKind::BitXor == op.node;
5757
if let ExprKind::Lit(lhs) = &left.kind;
58-
if let Some((lhs_val, lhs_type)) = unwrap_dec_int_literal(cx, lhs);
58+
if let Some((lhs_val, _)) = unwrap_dec_int_literal(cx, lhs);
5959
then {
6060
match &right.kind {
6161
ExprKind::Lit(rhs) => {

tests/ui/xor_used_as_pow.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ error: `^` is not an exponentiation operator but appears to have been used as on
44
LL | let _ = 10 ^ 4;
55
| ^^^^^^
66
|
7-
= help: did you mean to use .pow()?
87
= note: `-D clippy::xor-used-as-pow` implied by `-D warnings`
8+
= help: did you mean to use .pow()?
99

1010
error: `^` is not an exponentiation operator but appears to have been used as one
1111
--> $DIR/xor_used_as_pow.rs:27:17

tests/ui/xor_used_as_pow_fixable.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
error: it appears you are trying to get a power of two, but `^` is not an exponentiation operator
2-
--> $DIR/xor_used_as_pow.rs:25:13
2+
--> $DIR/xor_used_as_pow_fixable.rs:25:13
33
|
44
LL | let _ = 2 ^ 3;
55
| ^^^^^ help: use a bitshift or constant instead: `1_u32 << 3`
66
|
77
= note: `-D clippy::xor-used-as-pow` implied by `-D warnings`
88

99
error: it appears you are trying to get a power of two, but `^` is not an exponentiation operator
10-
--> $DIR/xor_used_as_pow.rs:26:13
10+
--> $DIR/xor_used_as_pow_fixable.rs:26:13
1111
|
1212
LL | let _ = 2 ^ 32;
1313
| ^^^^^^ help: use a bitshift or constant instead: `1_u64 << 32`
1414

1515
error: it appears you are trying to get a power of two, but `^` is not an exponentiation operator
16-
--> $DIR/xor_used_as_pow.rs:29:17
16+
--> $DIR/xor_used_as_pow_fixable.rs:29:17
1717
|
1818
LL | let _ = 2 ^ x;
1919
| ^^^^^ help: use a bitshift or constant instead: `1 << x`

0 commit comments

Comments
 (0)