Skip to content

Commit c0e150a

Browse files
author
Stjepan Glavina
committed
Inline nested fn collapse
Since merge_sort is generic and collapse isn't, that means calls to collapse won't be inlined. inlined. Therefore, we must stick an `#[inline]` above `fn collapse`.
1 parent c8d73ea commit c0e150a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/libcollections/slice.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1611,6 +1611,7 @@ fn merge_sort<T, F>(v: &mut [T], mut compare: F)
16111611
// This function correctly checks invariants for the top four runs. Additionally, if the top
16121612
// run starts at index 0, it will always demand a merge operation until the stack is fully
16131613
// collapsed, in order to complete the sort.
1614+
#[inline]
16141615
fn collapse(runs: &[Run]) -> Option<usize> {
16151616
let n = runs.len();
16161617
if n >= 2 && (runs[n - 1].start == 0 ||

0 commit comments

Comments
 (0)