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
This lint detects inefficient or useless `{std,core}::mem::swap()` calls
such as:
```rust
// Should be `a = temp();`
swap(&mut a, &mut temp());
// Should be `*b = temp();`
swap(b, &mut temp());
// Should be `temp1(); temp2();` if we want to keep the side effects
swap(&mut temp1(), &mut temp2());
```
It also takes care of using a form appropriate for a `()` context if
`swap()` is part of a larger expression (don't ask me why this wouldn't
happen, I have no idea), by suggesting `{ x = y; }` (statement in block)
or `{std,core}::mem::drop((temp1(), temp2())`.
changelog: [`swap_with_temporary`]: new lint
Closerust-lang#1968
We already have
vec.len()
. There are a lot of other things that would be nice, particularly everything inoption
The text was updated successfully, but these errors were encountered: