diff --git a/library/core/src/slice/sort.rs b/library/core/src/slice/sort.rs index 2181f9a81185..990540f55f53 100644 --- a/library/core/src/slice/sort.rs +++ b/library/core/src/slice/sort.rs @@ -198,9 +198,7 @@ pub fn heapsort(v: &mut [T], mut is_less: F) } // Choose the greater child. - if child + 1 < v.len() && is_less(&v[child], &v[child + 1]) { - child += 1; - } + child += (child + 1 < v.len() && is_less(&v[child], &v[child + 1])) as usize; // Stop if the invariant holds at `node`. if !is_less(&v[node], &v[child]) {