What it does
This lint would find instances of a user converting two pointers into mutable references and calling swap on them. It would error upon finding them.
By the way, this mistake is an actual thing I once saw on production code: dimforge/nalgebra#919
Categories
- Kind:
clippy::correctness.
What is the advantage of the recommended code over the original code
If a and b are equal or overlap, the original code is actually UB, while the latter isn't.
Drawbacks
None that I can think of.