You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Clippy applies the wrong fix to the following code:
fn g() {
for x in vec![0, 1] {
f(x);
}
}
fn f(x: usize) { }
with the error:
The following errors were reported:
error[E0308]: mismatched types
--> crate/src/lib.rs:8:11
|
8 | f(x);
| - ^ expected `usize`, found `&{integer}`
| |
| arguments to this function are incorrect
|
note: function defined here
--> crate/src/lib.rs:12:4
|
12 | fn f(_x: usize) { }
| ^ ---------
help: consider dereferencing the borrow
|
8 | f(*x);
| +
It seems that clippy replaced vec![0, 1] with &[0, 1], which is not correct. For Edition 2021, it should replace it with [0, 1] instead.