Closed
Description
What it does
Checks for usage of vec.drain(..)
(iterator dropped immediately) which can be replaced with vec.clear()
Lint Name
unnecessary_vec_drain
Category
style
Advantage
- Makes intent clearer
- Marginally more efficient, especially in debug builds
Drawbacks
No response
Example
vec.drain(..);
Could be written as:
vec.clear();