Description
I implemented clear_with_drain for Vec
, and then I had a look at #9059 and saw that manual_retain
applies to a bunch of containers (BTW I admire your work on that lint @kyoto7250 👏).
So I'm thinking clear_with_drain
should probably be extended in a similar fashion to apply to the collections in std
that have both a clear
and a drain
method, i.e.:
What do you think?
Also note that the documentations for Vec, VecDeque and String explicitly mention that drain
with a full range will clear the container, "like clear()
does". Does this change anything regarding the category proposed originally in #9339? Style was suggested, but that would mean the examples in the standard library would get warnings 😅. Maybe Pedantic is more suitable?
@rustbot label +C-enhancement