-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
drain() doc of vector (and others) is still unclear #92765
Copy link
Copy link
Closed
Labels
A-collectionsArea: `std::collections`Area: `std::collections`A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-collectionsArea: `std::collections`Area: `std::collections`A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
The description of Vec::drain:
mem::forgetas if that is just one of the ways to use the iterator, which makes the description harder to understand if you're not advanced in Rust.Vec::draingrants itself elsewhere, it might be helpful to clarify. None of the otherdrainmethods say this either (Perhaps improve the documentation of drain members further #93769).Vec::into_iteralso doesn't but I believe the fact that the signature says it consumes the container implies it.VecDeque::drain has the same issue (and got missed by #74652). String::drain probably too, it doesn't mention what may happen if you mem::forget the iterator.
@rustbot label A-collections A-docs C-enhancement T-libs-api