150
150
151
151
extern crate num;
152
152
153
- use std:: ops:: Index ;
154
- use std:: ops:: IndexMut ;
155
- use std:: ops:: AddAssign ;
156
- use std:: ops:: SubAssign ;
157
153
use std:: borrow:: Borrow ;
154
+ use std:: cmp;
155
+ use std:: ops:: { Index , IndexMut , AddAssign , SubAssign } ;
158
156
159
157
use iterators:: HistogramIterator ;
160
158
@@ -696,8 +694,7 @@ impl<T: Counter> Histogram<T> {
696
694
697
695
/// Allocate a counts array of the given size.
698
696
fn alloc ( & mut self , len : usize ) {
699
- use std:: iter;
700
- self . counts = iter:: repeat ( T :: zero ( ) ) . take ( len) . collect ( ) ;
697
+ self . counts = std:: iter:: repeat ( T :: zero ( ) ) . take ( len) . collect ( ) ;
701
698
}
702
699
703
700
// ********************************************************************************************
@@ -1078,8 +1075,6 @@ impl<T: Counter> Histogram<T> {
1078
1075
///
1079
1076
/// Two values are considered "equivalent" if `self.equivalent` would return true.
1080
1077
pub fn percentile_below ( & self , value : u64 ) -> f64 {
1081
- use std:: cmp;
1082
-
1083
1078
if self . total_count == 0 {
1084
1079
return 100.0 ;
1085
1080
}
@@ -1101,7 +1096,6 @@ impl<T: Counter> Histogram<T> {
1101
1096
///
1102
1097
/// May fail if the given values are out of bounds.
1103
1098
pub fn count_between ( & self , low : u64 , high : u64 ) -> Result < T , ( ) > {
1104
- use std:: cmp;
1105
1099
let low_index = self . index_for ( low) ;
1106
1100
let high_index = cmp:: min ( self . index_for ( high) , self . last ( ) ) ;
1107
1101
Ok ( ( low_index..( high_index + 1 ) ) . map ( |i| self [ i] ) . fold ( T :: zero ( ) , |t, v| t + v) )
@@ -1115,7 +1109,6 @@ impl<T: Counter> Histogram<T> {
1115
1109
///
1116
1110
/// May fail if the given value is out of bounds.
1117
1111
pub fn count_at ( & self , value : u64 ) -> Result < T , ( ) > {
1118
- use std:: cmp;
1119
1112
Ok ( self [ cmp:: min ( self . index_for ( value) , self . last ( ) ) ] )
1120
1113
}
1121
1114
0 commit comments