summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/swap.fixed
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/tests/ui/swap.fixed')
-rw-r--r--src/tools/clippy/tests/ui/swap.fixed21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/tools/clippy/tests/ui/swap.fixed b/src/tools/clippy/tests/ui/swap.fixed
index fa89706a8..9703674d1 100644
--- a/src/tools/clippy/tests/ui/swap.fixed
+++ b/src/tools/clippy/tests/ui/swap.fixed
@@ -1,4 +1,5 @@
// run-rustfix
+// aux-build: macro_rules.rs
#![warn(clippy::all)]
#![allow(
@@ -8,7 +9,8 @@
redundant_semicolons,
dead_code,
unused_assignments,
- unused_variables
+ unused_variables,
+ clippy::let_and_return
)]
struct Foo(u32);
@@ -65,19 +67,19 @@ fn xor_swap_locals() {
// This is an xor-based swap of local variables.
let mut a = 0;
let mut b = 1;
- std::mem::swap(&mut a, &mut b)
+ std::mem::swap(&mut a, &mut b);
}
fn xor_field_swap() {
// This is an xor-based swap of fields in a struct.
let mut bar = Bar { a: 0, b: 1 };
- std::mem::swap(&mut bar.a, &mut bar.b)
+ std::mem::swap(&mut bar.a, &mut bar.b);
}
fn xor_slice_swap() {
// This is an xor-based swap of a slice
let foo = &mut [1, 2];
- foo.swap(0, 1)
+ foo.swap(0, 1);
}
fn xor_no_swap() {
@@ -186,3 +188,14 @@ const fn issue_9864(mut u: u32) -> u32 {
v = temp;
u + v
}
+
+#[macro_use]
+extern crate macro_rules;
+
+const fn issue_10421(x: u32) -> u32 {
+ issue_10421!();
+ let a = x;
+ let a = a;
+ let a = a;
+ a
+}