rust/tests/ui/manual_swap_auto_fix.stderr
not-elm 0478d26c8b FIX(12334): manual_swap auto fix
Initialization expressions are now generated when index is bound to a variable.

FIX: Check to see if variables are used after swap

FIX:  rename StmtKind::Local to StmtKind::Let
2024-04-02 22:30:34 +09:00

89 lines
2.4 KiB
Plaintext

error: this looks like you are swapping elements of `v` manually
--> tests/ui/manual_swap_auto_fix.rs:6:5
|
LL | / let index = v[0];
LL | |
LL | | v[0] = v[index];
LL | | v[index] = index;
| |_____________________^
|
= note: `-D clippy::manual-swap` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::manual_swap)]`
help: try
|
LL ~ let index = v[0];
LL + v.swap(0, index);
|
error: this looks like you are swapping elements of `v` manually
--> tests/ui/manual_swap_auto_fix.rs:14:5
|
LL | / let tmp = v[0];
LL | | v[0] = v[1];
LL | | v[1] = tmp;
| |_______________^
|
help: try
|
LL ~ let tmp = v[0];
LL + v.swap(0, 1);
|
error: this looks like you are swapping elements of `v` manually
--> tests/ui/manual_swap_auto_fix.rs:25:5
|
LL | / let temp = v[i1];
LL | | v[i1] = v[i2];
LL | | v[i2] = temp;
| |_________________^ help: try: `v.swap(i1, i2);`
error: this looks like you are swapping elements of `v` manually
--> tests/ui/manual_swap_auto_fix.rs:34:5
|
LL | / let temp = v[i1];
LL | | v[i1] = v[i2 + 1];
LL | | v[i2 + 1] = temp;
| |_____________________^ help: try: `v.swap(i1, i2 + 1);`
error: this looks like you are swapping elements of `v` manually
--> tests/ui/manual_swap_auto_fix.rs:43:5
|
LL | / let temp = v[i1];
LL | | v[i1] = v[i2 + 1];
LL | | v[i2 + 1] = temp;
| |_____________________^ help: try: `v.swap(i1, i2 + 1);`
error: this looks like you are swapping elements of `v` manually
--> tests/ui/manual_swap_auto_fix.rs:50:5
|
LL | / let index = v[0];
LL | |
LL | | v[0] = v[index + 1];
LL | | v[index + 1] = index;
| |_________________________^
|
help: try
|
LL ~ let index = v[0];
LL + v.swap(0, index + 1);
|
error: this looks like you are swapping elements of `v` manually
--> tests/ui/manual_swap_auto_fix.rs:60:5
|
LL | / let tmp = v[i1 * 3];
LL | | v[i1 * 3] = v[i2 / 2];
LL | | v[i2 / 2] = tmp;
| |____________________^ help: try: `v.swap(i1 * 3, i2 / 2);`
error: this looks like you are swapping elements of `v` manually
--> tests/ui/manual_swap_auto_fix.rs:69:5
|
LL | / let tmp = v[i1 + i2];
LL | | v[i1 + i2] = v[i2];
LL | | v[i2] = tmp;
| |________________^ help: try: `v.swap(i1 + i2, i2);`
error: aborting due to 8 previous errors