@@ -57,24 +57,23 @@ impl<K, V> BTreeMap<K, V> {
5757 assert ! ( root_node. ascend( ) . is_err( ) ) ;
5858 root_node. assert_back_pointers ( ) ;
5959
60- // Check consistenty of `length` and some of the navigation .
60+ // Check consistency of `length` with what navigation code encounters .
6161 assert_eq ! ( self . length, root_node. calc_length( ) ) ;
62- assert_eq ! ( self . length, self . keys( ) . count( ) ) ;
6362
6463 // Lastly, check the invariant causing the least harm.
6564 root_node. assert_min_len ( if root_node. height ( ) > 0 { 1 } else { 0 } ) ;
6665 } else {
67- // Check consistenty of `length` and some of the navigation.
6866 assert_eq ! ( self . length, 0 ) ;
69- assert_eq ! ( self . length, self . keys( ) . count( ) ) ;
7067 }
68+
69+ // Check that `assert_strictly_ascending` will encounter all keys.
70+ assert_eq ! ( self . length, self . keys( ) . count( ) ) ;
7171 }
7272
7373 // Panics if the map is corrupted or if the keys are not in strictly
7474 // ascending order, in the current opinion of the `Ord` implementation.
75- // If the `Ord` implementation does not honor transitivity, this method
76- // does not guarantee that all the keys are unique, just that adjacent
77- // keys are unique.
75+ // If the `Ord` implementation violates transitivity, this method does not
76+ // guarantee that all keys are unique, just that adjacent keys are unique.
7877 fn check ( & self )
7978 where
8079 K : Debug + Ord ,
@@ -880,6 +879,7 @@ mod test_drain_filter {
880879 map. check ( ) ;
881880 }
882881
882+ // Explicitly consumes the iterator, where most test cases drop it instantly.
883883 #[ test]
884884 fn consumed_keeping_all ( ) {
885885 let pairs = ( 0 ..3 ) . map ( |i| ( i, i) ) ;
@@ -888,6 +888,7 @@ mod test_drain_filter {
888888 map. check ( ) ;
889889 }
890890
891+ // Explicitly consumes the iterator, where most test cases drop it instantly.
891892 #[ test]
892893 fn consumed_removing_all ( ) {
893894 let pairs = ( 0 ..3 ) . map ( |i| ( i, i) ) ;
@@ -897,15 +898,7 @@ mod test_drain_filter {
897898 map. check ( ) ;
898899 }
899900
900- #[ test]
901- fn dropped_removing_all ( ) {
902- let pairs = ( 0 ..3 ) . map ( |i| ( i, i) ) ;
903- let mut map: BTreeMap < _ , _ > = pairs. collect ( ) ;
904- map. drain_filter ( |_, _| true ) ;
905- assert ! ( map. is_empty( ) ) ;
906- map. check ( ) ;
907- }
908-
901+ // Explicitly consumes the iterator and modifies values through it.
909902 #[ test]
910903 fn mutating_and_keeping ( ) {
911904 let pairs = ( 0 ..3 ) . map ( |i| ( i, i) ) ;
@@ -922,6 +915,7 @@ mod test_drain_filter {
922915 map. check ( ) ;
923916 }
924917
918+ // Explicitly consumes the iterator and modifies values through it.
925919 #[ test]
926920 fn mutating_and_removing ( ) {
927921 let pairs = ( 0 ..3 ) . map ( |i| ( i, i) ) ;
0 commit comments