Skip to content

Commit 2c4e8b8

Browse files
committed
Fix incorrect uses of bitwise_bool in dogfood
1 parent 05c8fe5 commit 2c4e8b8

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

clippy_lints/src/loops/needless_range_loop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ pub(super) fn check<'tcx>(
107107
take_expr = left;
108108
}
109109

110-
end_is_start_plus_val = start_equal_left | start_equal_right;
110+
end_is_start_plus_val = start_equal_left || start_equal_right;
111111
}
112112
}
113113

clippy_lints/src/methods/unnecessary_filter_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ fn check_expression<'tcx>(cx: &LateContext<'tcx>, arg_id: hir::HirId, expr: &'tc
8282
hir::ExprKind::If(_, if_arm, Some(else_arm)) => {
8383
let if_check = check_expression(cx, arg_id, if_arm);
8484
let else_check = check_expression(cx, arg_id, else_arm);
85-
(if_check.0 | else_check.0, if_check.1 | else_check.1)
85+
(if_check.0 || else_check.0, if_check.1 || else_check.1)
8686
},
8787
hir::ExprKind::Path(path) if is_lang_ctor(cx, path, OptionNone) => (false, true),
8888
_ => (true, true),

clippy_lints/src/needless_bool.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ impl<'tcx> LateLintPass<'tcx> for BoolComparison {
165165
)),
166166
ignore_case,
167167
Some((
168-
|l: Sugg<'_>, r: Sugg<'_>| (!l).bit_and(&r),
168+
|l: Sugg<'_>, r: Sugg<'_>| (!l).and(&r),
169169
"order comparisons between booleans can be simplified",
170170
)),
171171
),
@@ -180,7 +180,7 @@ impl<'tcx> LateLintPass<'tcx> for BoolComparison {
180180
ignore_case,
181181
Some((|h| h, "greater than checks against false are unnecessary")),
182182
Some((
183-
|l: Sugg<'_>, r: Sugg<'_>| l.bit_and(&(!r)),
183+
|l: Sugg<'_>, r: Sugg<'_>| l.and(&(!r)),
184184
"order comparisons between booleans can be simplified",
185185
)),
186186
),

clippy_lints/src/use_self.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ impl<'tcx> LateLintPass<'tcx> for UseSelf {
236236
}
237237

238238
fn check_ty(&mut self, cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>) {
239-
if in_macro(hir_ty.span) | in_impl(cx, hir_ty) | !meets_msrv(self.msrv.as_ref(), &USE_SELF_MSRV) {
239+
if in_macro(hir_ty.span) || in_impl(cx, hir_ty) || !meets_msrv(self.msrv.as_ref(), &USE_SELF_MSRV) {
240240
return;
241241
}
242242

@@ -288,7 +288,7 @@ impl<'tcx> LateLintPass<'tcx> for UseSelf {
288288
}
289289
}
290290

291-
if in_macro(expr.span) | !meets_msrv(self.msrv.as_ref(), &USE_SELF_MSRV) {
291+
if in_macro(expr.span) || !meets_msrv(self.msrv.as_ref(), &USE_SELF_MSRV) {
292292
return;
293293
}
294294

tests/ui/bool_comparison.fixed

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ fn main() {
6565
"no"
6666
};
6767
let y = true;
68-
if !x & y {
68+
if !x && y {
6969
"yes"
7070
} else {
7171
"no"
7272
};
73-
if x & !y {
73+
if x && !y {
7474
"yes"
7575
} else {
7676
"no"

tests/ui/bool_comparison.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ error: order comparisons between booleans can be simplified
7676
--> $DIR/bool_comparison.rs:68:8
7777
|
7878
LL | if x < y {
79-
| ^^^^^ help: try simplifying it as shown: `!x & y`
79+
| ^^^^^ help: try simplifying it as shown: `!x && y`
8080

8181
error: order comparisons between booleans can be simplified
8282
--> $DIR/bool_comparison.rs:73:8
8383
|
8484
LL | if x > y {
85-
| ^^^^^ help: try simplifying it as shown: `x & !y`
85+
| ^^^^^ help: try simplifying it as shown: `x && !y`
8686

8787
error: this comparison might be written more concisely
8888
--> $DIR/bool_comparison.rs:121:8

0 commit comments

Comments
 (0)