Skip to content

Commit 736b225

Browse files
committed
Move BufGuard impl outside of function
1 parent a44e7b3 commit 736b225

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

alloc/src/slice.rs

+10-11
Original file line numberDiff line numberDiff line change
@@ -864,18 +864,17 @@ fn stable_sort<T, F>(v: &mut [T], mut is_less: F)
864864
where
865865
F: FnMut(&T, &T) -> bool,
866866
{
867-
use sort::stable::BufGuard;
868-
869-
#[unstable(issue = "none", feature = "std_internals")]
870-
impl<T> BufGuard<T> for Vec<T> {
871-
fn with_capacity(capacity: usize) -> Self {
872-
Vec::with_capacity(capacity)
873-
}
867+
sort::stable::sort::<T, F, Vec<T>>(v, &mut is_less);
868+
}
874869

875-
fn as_uninit_slice_mut(&mut self) -> &mut [MaybeUninit<T>] {
876-
self.spare_capacity_mut()
877-
}
870+
#[cfg(not(no_global_oom_handling))]
871+
#[unstable(issue = "none", feature = "std_internals")]
872+
impl<T> sort::stable::BufGuard<T> for Vec<T> {
873+
fn with_capacity(capacity: usize) -> Self {
874+
Vec::with_capacity(capacity)
878875
}
879876

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

0 commit comments

Comments
 (0)