File tree 2 files changed +2
-17
lines changed
2 files changed +2
-17
lines changed Original file line number Diff line number Diff line change 29
29
#![ feature( staged_api) ]
30
30
#![ feature( termination_trait_lib) ]
31
31
#![ feature( test) ]
32
+ #![ feature( total_cmp) ]
32
33
33
34
// Public reexports
34
35
pub use self :: bench:: { black_box, Bencher } ;
Original file line number Diff line number Diff line change 1
1
#![ allow( missing_docs) ]
2
2
#![ allow( deprecated) ] // Float
3
3
4
- use std:: cmp:: Ordering :: { self , Equal , Greater , Less } ;
5
4
use std:: mem;
6
5
7
6
#[ cfg( test) ]
8
7
mod tests;
9
8
10
- fn local_cmp ( x : f64 , y : f64 ) -> Ordering {
11
- // arbitrarily decide that NaNs are larger than everything.
12
- if y. is_nan ( ) {
13
- Less
14
- } else if x. is_nan ( ) {
15
- Greater
16
- } else if x < y {
17
- Less
18
- } else if x == y {
19
- Equal
20
- } else {
21
- Greater
22
- }
23
- }
24
-
25
9
fn local_sort ( v : & mut [ f64 ] ) {
26
- v. sort_by ( |x : & f64 , y : & f64 | local_cmp ( * x , * y) ) ;
10
+ v. sort_by ( |x : & f64 , y : & f64 | x . total_cmp ( y) ) ;
27
11
}
28
12
29
13
/// Trait that provides simple descriptive statistics on a univariate set of numeric samples.
You can’t perform that action at this time.
0 commit comments