Skip to content

Commit 21adfd5

Browse files
author
blake2-ppc
committed
dlist: Use Ord for .insert_ordered()
We don't need TotalOrd for ordered insertion, just the normal sort order Ord.
1 parent b1a071e commit 21adfd5

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/libextra/dlist.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
// the reverse direction.
2424

2525
use std::cast;
26-
use std::cmp;
2726
use std::ptr;
2827
use std::util;
2928
use std::iterator::{FromIterator, InvertIterator};
@@ -396,13 +395,13 @@ impl<T> DList<T> {
396395
}
397396
}
398397

399-
impl<T: cmp::TotalOrd> DList<T> {
398+
impl<T: Ord> DList<T> {
400399
/// Insert `elt` sorted in ascending order
401400
///
402401
/// O(N)
403402
#[inline]
404403
pub fn insert_ordered(&mut self, elt: T) {
405-
self.insert_when(elt, |a, b| a.cmp(b) != cmp::Less);
404+
self.insert_when(elt, |a, b| a >= b)
406405
}
407406
}
408407

0 commit comments

Comments
 (0)