@@ -64,32 +64,20 @@ fn lt<K: Ord + TotalOrd, V: Ord>(a: &TreeMap<K, V>,
6464impl < K : Ord + TotalOrd , V : Ord > Ord for TreeMap < K , V > {
6565 #[ inline]
6666 fn lt ( & self , other : & TreeMap < K , V > ) -> bool { lt ( self , other) }
67- #[ inline]
68- fn le ( & self , other : & TreeMap < K , V > ) -> bool { !lt ( other, self ) }
69- #[ inline]
70- fn ge ( & self , other : & TreeMap < K , V > ) -> bool { !lt ( self , other) }
71- #[ inline]
72- fn gt ( & self , other : & TreeMap < K , V > ) -> bool { lt ( other, self ) }
7367}
7468
7569impl < K : TotalOrd , V > Container for TreeMap < K , V > {
76- /// Return the number of elements in the map
7770 fn len ( & self ) -> uint { self . length }
78-
79- /// Return true if the map contains no elements
80- fn is_empty ( & self ) -> bool { self . root . is_none ( ) }
8171}
8272
8373impl < K : TotalOrd , V > Mutable for TreeMap < K , V > {
84- /// Clear the map, removing all key-value pairs.
8574 fn clear ( & mut self ) {
8675 self . root = None ;
8776 self . length = 0
8877 }
8978}
9079
9180impl < K : TotalOrd , V > Map < K , V > for TreeMap < K , V > {
92- /// Return a reference to the value corresponding to the key
9381 fn find < ' a > ( & ' a self , key : & K ) -> Option < & ' a V > {
9482 let mut current: & ' a Option < ~TreeNode < K , V > > = & self . root ;
9583 loop {
@@ -108,22 +96,17 @@ impl<K: TotalOrd, V> Map<K, V> for TreeMap<K, V> {
10896}
10997
11098impl < K : TotalOrd , V > MutableMap < K , V > for TreeMap < K , V > {
111- /// Return a mutable reference to the value corresponding to the key
11299 #[ inline]
113100 fn find_mut < ' a > ( & ' a mut self , key : & K ) -> Option < & ' a mut V > {
114101 find_mut ( & mut self . root , key)
115102 }
116103
117- /// Insert a key-value pair from the map. If the key already had a value
118- /// present in the map, that value is returned. Otherwise None is returned.
119104 fn swap ( & mut self , key : K , value : V ) -> Option < V > {
120105 let ret = insert ( & mut self . root , key, value) ;
121106 if ret. is_none ( ) { self . length += 1 }
122107 ret
123108 }
124109
125- /// Removes a key from the map, returning the value at the key if the key
126- /// was previously in the map.
127110 fn pop ( & mut self , key : & K ) -> Option < V > {
128111 let ret = remove ( & mut self . root , key) ;
129112 if ret. is_some ( ) { self . length -= 1 }
@@ -531,15 +514,13 @@ impl<K, V> Iterator<(K, V)> for MoveEntries<K,V> {
531514}
532515
533516impl < ' a , T > Iterator < & ' a T > for SetItems < ' a , T > {
534- /// Advance the iterator to the next node (in order). If there are no more nodes, return `None`.
535517 #[ inline]
536518 fn next ( & mut self ) -> Option < & ' a T > {
537519 self . iter . next ( ) . map ( |( value, _) | value)
538520 }
539521}
540522
541523impl < ' a , T > Iterator < & ' a T > for RevSetItems < ' a , T > {
542- /// Advance the iterator to the next node (in order). If there are no more nodes, return `None`.
543524 #[ inline]
544525 fn next ( & mut self ) -> Option < & ' a T > {
545526 self . iter . next ( ) . map ( |( value, _) | value)
@@ -557,19 +538,11 @@ pub struct TreeSet<T> {
557538impl < T : Eq + TotalOrd > Eq for TreeSet < T > {
558539 #[ inline]
559540 fn eq ( & self , other : & TreeSet < T > ) -> bool { self . map == other. map }
560- #[ inline]
561- fn ne ( & self , other : & TreeSet < T > ) -> bool { self . map != other. map }
562541}
563542
564543impl < T : Ord + TotalOrd > Ord for TreeSet < T > {
565544 #[ inline]
566545 fn lt ( & self , other : & TreeSet < T > ) -> bool { self . map < other. map }
567- #[ inline]
568- fn le ( & self , other : & TreeSet < T > ) -> bool { self . map <= other. map }
569- #[ inline]
570- fn ge ( & self , other : & TreeSet < T > ) -> bool { self . map >= other. map }
571- #[ inline]
572- fn gt ( & self , other : & TreeSet < T > ) -> bool { self . map > other. map }
573546}
574547
575548impl < T : TotalOrd > Container for TreeSet < T > {
0 commit comments