Skip to content

Commit

Permalink
Move BufGuard impl outside of function
Browse files Browse the repository at this point in the history
  • Loading branch information
Voultapher committed May 16, 2024
1 parent a44e7b3 commit 736b225
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions alloc/src/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -864,18 +864,17 @@ fn stable_sort<T, F>(v: &mut [T], mut is_less: F)
where
F: FnMut(&T, &T) -> bool,
{
use sort::stable::BufGuard;

#[unstable(issue = "none", feature = "std_internals")]
impl<T> BufGuard<T> for Vec<T> {
fn with_capacity(capacity: usize) -> Self {
Vec::with_capacity(capacity)
}
sort::stable::sort::<T, F, Vec<T>>(v, &mut is_less);
}

fn as_uninit_slice_mut(&mut self) -> &mut [MaybeUninit<T>] {
self.spare_capacity_mut()
}
#[cfg(not(no_global_oom_handling))]
#[unstable(issue = "none", feature = "std_internals")]
impl<T> sort::stable::BufGuard<T> for Vec<T> {
fn with_capacity(capacity: usize) -> Self {
Vec::with_capacity(capacity)
}

sort::stable::sort::<T, F, Vec<T>>(v, &mut is_less);
fn as_uninit_slice_mut(&mut self) -> &mut [MaybeUninit<T>] {
self.spare_capacity_mut()
}
}

0 comments on commit 736b225

Please sign in to comment.