Skip to content

Commit 1ec59cd

Browse files
committed
Remove debug unused
1 parent dbc0ed2 commit 1ec59cd

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

library/core/src/slice/sort.rs

+13-12
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
//! In addition it also contains the core logic of the stable sort used by `slice::sort` based on
1010
//! TimSort.
1111
12-
#![allow(unused)] // FIXME debug
13-
1412
use crate::cmp;
1513
use crate::mem::{self, MaybeUninit, SizedTypeProperties};
1614
use crate::ptr;
@@ -1167,7 +1165,7 @@ pub fn merge_sort<T, CmpF, ElemAllocF, ElemDeallocF, RunAllocF, RunDeallocF>(
11671165
// shallow copies of the contents of `v` without risking the dtors running on copies if
11681166
// `is_less` panics. When merging two sorted runs, this buffer holds a copy of the shorter run,
11691167
// which will always have length at most `len / 2`.
1170-
let mut buf = BufGuard::new(len / 2, elem_alloc_fn, elem_dealloc_fn);
1168+
let buf = BufGuard::new(len / 2, elem_alloc_fn, elem_dealloc_fn);
11711169
let buf_ptr = buf.buf_ptr;
11721170

11731171
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>(
12551253
// Extremely basic versions of Vec.
12561254
// Their use is super limited and by having the code here, it allows reuse between the sort
12571255
// implementations.
1258-
struct BufGuard<T, ElemAllocF, ElemDeallocF>
1256+
struct BufGuard<T, ElemDeallocF>
12591257
where
1260-
ElemAllocF: Fn(usize) -> *mut T,
12611258
ElemDeallocF: Fn(*mut T, usize),
12621259
{
12631260
buf_ptr: *mut T,
12641261
capacity: usize,
1265-
elem_alloc_fn: ElemAllocF,
12661262
elem_dealloc_fn: ElemDeallocF,
12671263
}
12681264

1269-
impl<T, ElemAllocF, ElemDeallocF> BufGuard<T, ElemAllocF, ElemDeallocF>
1265+
impl<T, ElemDeallocF> BufGuard<T, ElemDeallocF>
12701266
where
1271-
ElemAllocF: Fn(usize) -> *mut T,
12721267
ElemDeallocF: Fn(*mut T, usize),
12731268
{
1274-
fn new(len: usize, elem_alloc_fn: ElemAllocF, elem_dealloc_fn: ElemDeallocF) -> Self {
1275-
Self { buf_ptr: elem_alloc_fn(len), capacity: len, elem_alloc_fn, elem_dealloc_fn }
1269+
fn new<ElemAllocF>(
1270+
len: usize,
1271+
elem_alloc_fn: ElemAllocF,
1272+
elem_dealloc_fn: ElemDeallocF,
1273+
) -> Self
1274+
where
1275+
ElemAllocF: Fn(usize) -> *mut T,
1276+
{
1277+
Self { buf_ptr: elem_alloc_fn(len), capacity: len, elem_dealloc_fn }
12761278
}
12771279
}
12781280

1279-
impl<T, ElemAllocF, ElemDeallocF> Drop for BufGuard<T, ElemAllocF, ElemDeallocF>
1281+
impl<T, ElemDeallocF> Drop for BufGuard<T, ElemDeallocF>
12801282
where
1281-
ElemAllocF: Fn(usize) -> *mut T,
12821283
ElemDeallocF: Fn(*mut T, usize),
12831284
{
12841285
fn drop(&mut self) {

0 commit comments

Comments
 (0)