diff options
| author | Lukas Bergdoll <lukas.bergdoll@gmail.com> | 2022-11-21 14:20:31 +0100 |
|---|---|---|
| committer | Lukas Bergdoll <lukas.bergdoll@gmail.com> | 2022-11-21 14:20:31 +0100 |
| commit | 1ec59cdcd16fb2821bdf5944c3bbef51c57f7a5c (patch) | |
| tree | f2904dae5e5ee513655fe8a0789d03c640b01637 | |
| parent | dbc0ed2a109a3409bd21529ca8375a43d5580739 (diff) | |
| download | rust-1ec59cdcd16fb2821bdf5944c3bbef51c57f7a5c.tar.gz rust-1ec59cdcd16fb2821bdf5944c3bbef51c57f7a5c.zip | |
Remove debug unused
| -rw-r--r-- | library/core/src/slice/sort.rs | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/library/core/src/slice/sort.rs b/library/core/src/slice/sort.rs index 07c68bf6aa4..8ef3535af2d 100644 --- a/library/core/src/slice/sort.rs +++ b/library/core/src/slice/sort.rs @@ -9,8 +9,6 @@ //! In addition it also contains the core logic of the stable sort used by `slice::sort` based on //! TimSort. -#![allow(unused)] // FIXME debug - use crate::cmp; use crate::mem::{self, MaybeUninit, SizedTypeProperties}; use crate::ptr; @@ -1167,7 +1165,7 @@ pub fn merge_sort<T, CmpF, ElemAllocF, ElemDeallocF, RunAllocF, RunDeallocF>( // shallow copies of the contents of `v` without risking the dtors running on copies if // `is_less` panics. When merging two sorted runs, this buffer holds a copy of the shorter run, // which will always have length at most `len / 2`. - let mut buf = BufGuard::new(len / 2, elem_alloc_fn, elem_dealloc_fn); + let buf = BufGuard::new(len / 2, elem_alloc_fn, elem_dealloc_fn); let buf_ptr = buf.buf_ptr; let mut runs = RunVec::new(run_alloc_fn, run_dealloc_fn); @@ -1255,30 +1253,33 @@ pub fn merge_sort<T, CmpF, ElemAllocF, ElemDeallocF, RunAllocF, RunDeallocF>( // Extremely basic versions of Vec. // Their use is super limited and by having the code here, it allows reuse between the sort // implementations. - struct BufGuard<T, ElemAllocF, ElemDeallocF> + struct BufGuard<T, ElemDeallocF> where - ElemAllocF: Fn(usize) -> *mut T, ElemDeallocF: Fn(*mut T, usize), { buf_ptr: *mut T, capacity: usize, - elem_alloc_fn: ElemAllocF, elem_dealloc_fn: ElemDeallocF, } - impl<T, ElemAllocF, ElemDeallocF> BufGuard<T, ElemAllocF, ElemDeallocF> + impl<T, ElemDeallocF> BufGuard<T, ElemDeallocF> where - ElemAllocF: Fn(usize) -> *mut T, ElemDeallocF: Fn(*mut T, usize), { - fn new(len: usize, elem_alloc_fn: ElemAllocF, elem_dealloc_fn: ElemDeallocF) -> Self { - Self { buf_ptr: elem_alloc_fn(len), capacity: len, elem_alloc_fn, elem_dealloc_fn } + fn new<ElemAllocF>( + len: usize, + elem_alloc_fn: ElemAllocF, + elem_dealloc_fn: ElemDeallocF, + ) -> Self + where + ElemAllocF: Fn(usize) -> *mut T, + { + Self { buf_ptr: elem_alloc_fn(len), capacity: len, elem_dealloc_fn } } } - impl<T, ElemAllocF, ElemDeallocF> Drop for BufGuard<T, ElemAllocF, ElemDeallocF> + impl<T, ElemDeallocF> Drop for BufGuard<T, ElemDeallocF> where - ElemAllocF: Fn(usize) -> *mut T, ElemDeallocF: Fn(*mut T, usize), { fn drop(&mut self) { |
