Skip to content

Docs, code cleanup, and misc. fixes for smallvec #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Dec 6, 2016

Conversation

mbrubeck
Copy link
Collaborator

@mbrubeck mbrubeck commented Dec 5, 2016

This change is Reviewable

@mbrubeck mbrubeck force-pushed the docs branch 2 times, most recently from c0f6ad0 to 3ac0159 Compare December 5, 2016 21:48
@@ -130,13 +150,45 @@ impl<A: Array> Drop for SmallVecData<A> {
}
}


/// A Vec-like that can store a small number of elements inline.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`Vec`-like

@@ -245,6 +310,9 @@ impl<A: Array> SmallVec<A> {
}
}

/// Reserve capacity for at least `additional` more elements to be inserted.
///
/// May reserve more space to avoid frequent reallocations.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe make a note about overflow behaviour. In particular, it is not safe to assume that you can actually fit additional new elements in it!

if self.spilled() && self.capacity() > len {
if len <= self.inline_size() {
unsafe {
let (ptr, capacity) = match &self.data {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why borrow self.data?

@mbrubeck
Copy link
Collaborator Author

mbrubeck commented Dec 6, 2016

@bors-servo r=Ms2ger

  • Addressed review comments
  • Added some whitespace cleanup
  • Bumped patch version

@bors-servo
Copy link
Contributor

📌 Commit 7ca4463 has been approved by Ms2ger

@bors-servo
Copy link
Contributor

⚡ Test exempted - status

@bors-servo bors-servo merged commit 7ca4463 into servo:master Dec 6, 2016
bors-servo pushed a commit that referenced this pull request Dec 6, 2016
Docs, code cleanup, and misc. fixes for smallvec

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-smallvec/40)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants