Skip to content

Commit 17fb5ad

Browse files
committed
[] Fix FP on proc macros
1 parent d49501c commit 17fb5ad

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

clippy_lints/src/operators/bit_mask.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use clippy_utils::consts::{ConstEvalCtxt, Constant};
22
use clippy_utils::diagnostics::span_lint;
3+
use clippy_utils::is_from_proc_macro;
34
use rustc_hir::{BinOpKind, Expr, ExprKind};
45
use rustc_lint::LateContext;
56
use rustc_span::Span;
@@ -35,9 +36,9 @@ fn invert_cmp(cmp: BinOpKind) -> BinOpKind {
3536
}
3637
}
3738

38-
fn check_compare(cx: &LateContext<'_>, bit_op: &Expr<'_>, cmp_op: BinOpKind, cmp_value: u128, span: Span) {
39+
fn check_compare<'a>(cx: &LateContext<'a>, bit_op: &Expr<'a>, cmp_op: BinOpKind, cmp_value: u128, span: Span) {
3940
if let ExprKind::Binary(op, left, right) = &bit_op.kind {
40-
if op.node != BinOpKind::BitAnd && op.node != BinOpKind::BitOr {
41+
if op.node != BinOpKind::BitAnd && op.node != BinOpKind::BitOr || is_from_proc_macro(cx, bit_op) {
4142
return;
4243
}
4344
if let Some(mask) = fetch_int_literal(cx, right).or_else(|| fetch_int_literal(cx, left)) {

0 commit comments

Comments
 (0)