Replies: 1 comment
-
|
This lint is in the But also note that not every Clippy lint applies to every project. You might have use cases where you actually want to go against a Clippy lint. Then it is recommended to annotate that code with a #[expect(clippy::lint, reason = "this is intentional, because [...]")] |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
https://rust-lang.github.io/rust-clippy/rust-1.91.0/#iter_with_drain
Hey i was wondering about this lint. If i understand correctly drain does not deallocate the allocation of a Vec and keeps the capacity unttouched. I have a hotloop in my program i use to keep track of things i want to cleanup and then i drain the vec to do the cleanup but i dont want to use into_iter() as this drops the vec altogether.
I feel like there is genuine use cases for using drain as iteration like in this example.
I would like to hear some counter arguments on why this lint was designed like such and why i might be wrong.
Beta Was this translation helpful? Give feedback.
All reactions