@@ -56,24 +56,23 @@ impl<K, V> BTreeMap<K, V> {
5656 assert ! ( root_node. ascend( ) . is_err( ) ) ;
5757 root_node. assert_back_pointers ( ) ;
5858
59- // Check consistenty of `length` and some of the navigation .
59+ // Check consistency of `length` with what navigation code encounters .
6060 assert_eq ! ( self . length, root_node. calc_length( ) ) ;
61- assert_eq ! ( self . length, self . keys( ) . count( ) ) ;
6261
6362 // Lastly, check the invariant causing the least harm.
6463 root_node. assert_min_len ( if root_node. height ( ) > 0 { 1 } else { 0 } ) ;
6564 } else {
66- // Check consistenty of `length` and some of the navigation.
6765 assert_eq ! ( self . length, 0 ) ;
68- assert_eq ! ( self . length, self . keys( ) . count( ) ) ;
6966 }
67+
68+ // Check that `assert_strictly_ascending` will encounter all keys.
69+ assert_eq ! ( self . length, self . keys( ) . count( ) ) ;
7070 }
7171
7272 // Panics if the map is corrupted or if the keys are not in strictly
7373 // ascending order, in the current opinion of the `Ord` implementation.
74- // If the `Ord` implementation does not honor transitivity, this method
75- // does not guarantee that all the keys are unique, just that adjacent
76- // keys are unique.
74+ // If the `Ord` implementation violates transitivity, this method does not
75+ // guarantee that all keys are unique, just that adjacent keys are unique.
7776 fn check ( & self )
7877 where
7978 K : Debug + Ord ,
@@ -879,6 +878,7 @@ mod test_drain_filter {
879878 map. check ( ) ;
880879 }
881880
881+ // Explicitly consumes the iterator, where most test cases drop it instantly.
882882 #[ test]
883883 fn consumed_keeping_all ( ) {
884884 let pairs = ( 0 ..3 ) . map ( |i| ( i, i) ) ;
@@ -887,6 +887,7 @@ mod test_drain_filter {
887887 map. check ( ) ;
888888 }
889889
890+ // Explicitly consumes the iterator, where most test cases drop it instantly.
890891 #[ test]
891892 fn consumed_removing_all ( ) {
892893 let pairs = ( 0 ..3 ) . map ( |i| ( i, i) ) ;
@@ -896,15 +897,7 @@ mod test_drain_filter {
896897 map. check ( ) ;
897898 }
898899
899- #[ test]
900- fn dropped_removing_all ( ) {
901- let pairs = ( 0 ..3 ) . map ( |i| ( i, i) ) ;
902- let mut map: BTreeMap < _ , _ > = pairs. collect ( ) ;
903- map. drain_filter ( |_, _| true ) ;
904- assert ! ( map. is_empty( ) ) ;
905- map. check ( ) ;
906- }
907-
900+ // Explicitly consumes the iterator and modifies values through it.
908901 #[ test]
909902 fn mutating_and_keeping ( ) {
910903 let pairs = ( 0 ..3 ) . map ( |i| ( i, i) ) ;
@@ -921,6 +914,7 @@ mod test_drain_filter {
921914 map. check ( ) ;
922915 }
923916
917+ // Explicitly consumes the iterator and modifies values through it.
924918 #[ test]
925919 fn mutating_and_removing ( ) {
926920 let pairs = ( 0 ..3 ) . map ( |i| ( i, i) ) ;
0 commit comments