Improved examples on Vec documentation#18254
Conversation
areski
commented
Oct 23, 2014
- shrink_to_fit example is now more clear by asserting the capacity value
- annotation [0, mid) changed for [0, mid]
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @huonw (or someone else) soon. |
|
An assert of the capacity will work right now, but there's no guarantee that it will drop all the way down to the length in the future. It will drop down as close as possible to the length but the allocator may still inform the vector that there is space for a few more elements. |
src/libcollections/vec.rs
Outdated
There was a problem hiding this comment.
why is this line changed? If it's exclusive, it should be a ).
There was a problem hiding this comment.
Thanks I removed this now, I thought it was a mistake in the annotation
- shrink_to_fit example is now more clear by asserting the capacity value
c5a5f5e to
fe6847a
Compare
|
@thestinger thanks for the clarification, then we can dismiss this PR and just add your comment after the line "Shrinks the capacity of the vector as much as possible." |
|
@areski do you want to update this PR with @thestinger's comment? |
… as close as possible but not to the minimun
|
@alexcrichton I just updated the Pr with the feedback, let me know |
…hton - shrink_to_fit example is now more clear by asserting the capacity value - annotation [0, mid) changed for [0, mid]
fix: Nail destructuring assignment once and for all