Another rustfmt PR.
I ran rustfmt, then split the changes in multiple commits. First commit are the non-problematic changed. The others are all the little weirdness that caught my attention and could be discussed.
These really aren't documented well at all. The fact that doc comments end on a `*/` is really weird. I'm not sure if this is a mistake or not though.
None of the block comments are even mentioned in the [book nightly](http://doc.rust-lang.org/nightly/book/comments.html). Probably should be fixed.
The first commit fixes the "jobserver unavailable" warning reported at gentoo/gentoo-rust#29. I don't think the warning is related to the compilation failure shown there.
The remaining commits are minor fixes I noticed while investigating the jobserver warning.
Simplify HIR folder so that it only maps 1 item to 1 item, removing a bunch of asserts. This is a small refactoring on the way to my larger branch for moving items out of line in the tree and isolating attempts to access them.
r? @nrc
The example given for the manual implementation of the core::fmt::Debug trait doesn't match the output after the code sample. This updates it so it matches.
Emacs warns that makefile lines that start with spaces followed by
tabs are "suspicious". These were harmless since they were
continuation lines, but getting rid of the warning is nice and this
version looks better.
The important one is $(MAKE). make handles recipes containing the
literal string "$(MAKE)" specially, so it is important to make sure it
isn't evaluated until recipe invocation time.
BinaryHeap: Simplify sift down
Sift down was doing all too much work: it can stop directly when the
current element obeys the heap property in relation to its children.
In the old code, sift down didn't compare the element to sift down at
all, so it was maximally sifted down and relied on the sift up call to
put it in the correct location.
This should speed up heapify and .pop().
Also rename Hole::removed() to Hole::element()
Sift down was doing all too much work: it can stop directly when the
current element obeys the heap property in relation to its children.
In the old code, sift down didn't compare the element to sift down at
all, so it was maximally sifted down and relied on the sift up call to
put it in the correct location.
This should speed up heapify and .pop().
Also rename Hole::removed() to Hole::element()
sort: Fast path for already sorted data
When merging two sorted blocks `left` and `right` if the last element in
`left` is <= the first in `right`, the blocks are already in sorted order.
Add this as an additional fast path by simply copying the whole left
block into the output and advancing the left pointer. The right block is
then treated the same way by the already present logic in the merge
loop.
Can reduce runtime of .sort() to less than 50% of the previous, if the data
was already perfectly sorted. Sorted data with a few swaps are also
sorted quicker than before. The overhead of one comparison per merge
seems to be negligible.