-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-collectionsArea: `std::collections`Area: `std::collections`E-hardCall for participation: Hard difficulty. Experience needed to fix: A lot.Call for participation: Hard difficulty. Experience needed to fix: A lot.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.
Description
The docs of Vec::truncate say:
"If len is greater than the vector's current length, this has no effect."
And indeed if you look at the source code:
https://doc.rust-lang.org/nightly/src/alloc/vec.rs.html#740-742
There's:
if len > self.len {
return;
}
But isn't it better to use len >= self.len
instead?
mo8it
Metadata
Metadata
Assignees
Labels
A-collectionsArea: `std::collections`Area: `std::collections`E-hardCall for participation: Hard difficulty. Experience needed to fix: A lot.Call for participation: Hard difficulty. Experience needed to fix: A lot.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.