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 would see the use of vec.drain(..).collect(), which moves all the items from a Vec<T> into a new Vec<T> via FromIterator, and suggest to instead use std::mem::take(&mut vec).
By taking the Vec and replacing it with a new one, you've moved the capacity, but the author may have intended to keep the capacity in place and perform the allocation/memcpy. This situation seems rare to me.
Example
// self.vec is a Vec<u32>fnfunc(&mutself) -> Vec<u32>{self.vec.drain(..).collect()}