Skip to content

Commit f15ce92

Browse files
committed
Fix testing
1 parent 8462b08 commit f15ce92

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

clippy_lints/src/swap.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ declare_lint_pass!(Swap => [MANUAL_SWAP, ALMOST_SWAPPED]);
7676
impl<'tcx> LateLintPass<'tcx> for Swap {
7777
fn check_block(&mut self, cx: &LateContext<'tcx>, block: &'tcx Block<'_>) {
7878
check_manual_swap(cx, block);
79-
if !in_external_macro(cx.sess(), block.span) {
80-
check_suspicious_swap(cx, block);
81-
}
79+
check_suspicious_swap(cx, block);
8280
check_xor_swap(cx, block);
8381
}
8482
}
@@ -191,6 +189,7 @@ fn check_suspicious_swap(cx: &LateContext<'_>, block: &Block<'_>) {
191189
if let Some((lhs0, rhs0)) = parse(first)
192190
&& let Some((lhs1, rhs1)) = parse(second)
193191
&& first.span.eq_ctxt(second.span)
192+
&& !in_external_macro(&cx.sess(), first.span)
194193
&& is_same(cx, lhs0, rhs1)
195194
&& is_same(cx, lhs1, rhs0)
196195
&& !is_same(cx, lhs1, rhs1) // Ignore a = b; a = a (#10421)

tests/ui/auxiliary/macro_rules.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ macro_rules! mut_mut {
3131
#[macro_export]
3232
macro_rules! issue_10421 {
3333
() => {
34-
let a = 1;
35-
let a = a;
36-
let a = a;
34+
let mut a = 1;
35+
let mut b = 2;
36+
a = b;
37+
b = a;
3738
};
3839
}

0 commit comments

Comments
 (0)