-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Conversation
self.data.push(item); | ||
let new_len = self.len() - 1; | ||
self.siftup(0, new_len); |
There was a problem hiding this comment.
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?
Awesome, this looks great modulo my two nits! |
Nits addressed. |
match self.data.get_mut(0) { | ||
None => return item, | ||
Some(top) => | ||
if *top > item { |
There was a problem hiding this comment.
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.
Variable naming and indentation addressed. |
Clean up `collections::binary_heap` Reviewed-by: Gankro
Just a few simplifications and a missing `assert!`.
Just a few simplifications and a missing
assert!
.