@@ -769,20 +769,6 @@ pub fn set_difference<T: Borrow<usize>, S: Borrow<usize>>(
769
769
. collect ( )
770
770
}
771
771
772
- /// Checks whether the given index sequence is monotonically non-decreasing.
773
- pub fn is_sorted < T : Borrow < usize > > ( sequence : impl IntoIterator < Item = T > ) -> bool {
774
- // TODO: Remove this function when `is_sorted` graduates from Rust nightly.
775
- let mut previous = 0 ;
776
- for item in sequence. into_iter ( ) {
777
- let current = * item. borrow ( ) ;
778
- if current < previous {
779
- return false ;
780
- }
781
- previous = current;
782
- }
783
- true
784
- }
785
-
786
772
/// Find indices of each element in `targets` inside `items`. If one of the
787
773
/// elements is absent in `items`, returns an error.
788
774
pub fn find_indices < T : PartialEq , S : Borrow < T > > (
@@ -1171,18 +1157,6 @@ mod tests {
1171
1157
assert_eq ! ( set_difference( [ 3 , 4 , 0 ] , [ 4 , 1 , 2 ] ) , vec![ 3 , 0 ] ) ;
1172
1158
}
1173
1159
1174
- #[ test]
1175
- fn test_is_sorted ( ) {
1176
- assert ! ( is_sorted:: <usize >( [ ] ) ) ;
1177
- assert ! ( is_sorted( [ 0 ] ) ) ;
1178
- assert ! ( is_sorted( [ 0 , 3 , 4 ] ) ) ;
1179
- assert ! ( is_sorted( [ 0 , 1 , 2 ] ) ) ;
1180
- assert ! ( is_sorted( [ 0 , 1 , 4 ] ) ) ;
1181
- assert ! ( is_sorted( [ 0usize ; 0 ] ) ) ;
1182
- assert ! ( is_sorted( [ 1 , 2 ] ) ) ;
1183
- assert ! ( !is_sorted( [ 3 , 2 ] ) ) ;
1184
- }
1185
-
1186
1160
#[ test]
1187
1161
fn test_find_indices ( ) -> Result < ( ) > {
1188
1162
assert_eq ! ( find_indices( & [ 0 , 3 , 4 ] , [ 0 , 3 , 4 ] ) ?, vec![ 0 , 1 , 2 ] ) ;
0 commit comments