Skip to content
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

Clean up collections::binary_heap #19967

Merged
merged 1 commit into from
Dec 22, 2014
Merged

Clean up collections::binary_heap #19967

merged 1 commit into from
Dec 22, 2014

Conversation

apasel422
Copy link
Contributor

Just a few simplifications and a missing assert!.

self.data.push(item);
let new_len = self.len() - 1;
self.siftup(0, new_len);
Copy link
Contributor

Choose a reason for hiding this comment

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

...why is it even called _new__len?

@Gankra
Copy link
Contributor

Gankra commented Dec 18, 2014

Awesome, this looks great modulo my two nits!

@apasel422
Copy link
Contributor Author

Nits addressed.

match self.data.get_mut(0) {
None => return item,
Some(top) =>
if *top > item {
Copy link
Contributor

Choose a reason for hiding this comment

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

Normally I would put the if itself on the same line to reduce the indentation level, but in this case I think it's fine like this.

@apasel422
Copy link
Contributor Author

Variable naming and indentation addressed.

bors added a commit that referenced this pull request Dec 19, 2014
Clean up `collections::binary_heap`

Reviewed-by: Gankro
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Dec 21, 2014
Just a few simplifications and a missing `assert!`.
@bors bors merged commit 01aa4ca into rust-lang:master Dec 22, 2014
@apasel422 apasel422 deleted the binary_heap branch December 22, 2014 02:54
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