Skip to content

Commit

Permalink
Fix testing
Browse files Browse the repository at this point in the history
  • Loading branch information
blyxyas committed Mar 16, 2023
1 parent 8462b08 commit f15ce92
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 2 additions & 3 deletions clippy_lints/src/swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ declare_lint_pass!(Swap => [MANUAL_SWAP, ALMOST_SWAPPED]);
impl<'tcx> LateLintPass<'tcx> for Swap {
fn check_block(&mut self, cx: &LateContext<'tcx>, block: &'tcx Block<'_>) {
check_manual_swap(cx, block);
if !in_external_macro(cx.sess(), block.span) {
check_suspicious_swap(cx, block);
}
check_suspicious_swap(cx, block);
check_xor_swap(cx, block);
}
}
Expand Down Expand Up @@ -191,6 +189,7 @@ fn check_suspicious_swap(cx: &LateContext<'_>, block: &Block<'_>) {
if let Some((lhs0, rhs0)) = parse(first)
&& let Some((lhs1, rhs1)) = parse(second)
&& first.span.eq_ctxt(second.span)
&& !in_external_macro(&cx.sess(), first.span)
&& is_same(cx, lhs0, rhs1)
&& is_same(cx, lhs1, rhs0)
&& !is_same(cx, lhs1, rhs1) // Ignore a = b; a = a (#10421)
Expand Down
7 changes: 4 additions & 3 deletions tests/ui/auxiliary/macro_rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ macro_rules! mut_mut {
#[macro_export]
macro_rules! issue_10421 {
() => {
let a = 1;
let a = a;
let a = a;
let mut a = 1;
let mut b = 2;
a = b;
b = a;
};
}

0 comments on commit f15ce92

Please sign in to comment.