@@ -77,21 +77,13 @@ pure fn lt<K: Ord + TotalOrd, V>(a: &TreeMap<K, V>,
7777
7878impl <K : Ord + TotalOrd , V > Ord for TreeMap < K , V > {
7979 #[ inline( always) ]
80- pure fn lt ( & self , other : & TreeMap < K , V > ) -> bool {
81- lt ( self , other)
82- }
80+ pure fn lt ( & self , other : & TreeMap < K , V > ) -> bool { lt ( self , other) }
8381 #[ inline( always) ]
84- pure fn le ( & self , other : & TreeMap < K , V > ) -> bool {
85- !lt ( other, self )
86- }
82+ pure fn le ( & self , other : & TreeMap < K , V > ) -> bool { !lt ( other, self ) }
8783 #[ inline( always) ]
88- pure fn ge ( & self , other : & TreeMap < K , V > ) -> bool {
89- !lt ( self , other)
90- }
84+ pure fn ge ( & self , other : & TreeMap < K , V > ) -> bool { !lt ( self , other) }
9185 #[ inline( always) ]
92- pure fn gt ( & self , other : & TreeMap < K , V > ) -> bool {
93- lt ( other, self )
94- }
86+ pure fn gt ( & self , other : & TreeMap < K , V > ) -> bool { lt ( other, self ) }
9587}
9688
9789impl < ' self , K : TotalOrd , V > BaseIter < ( & ' self K , & ' self V ) > for TreeMap < K , V > {
@@ -244,19 +236,24 @@ pub struct TreeSet<T> {
244236
245237impl < T : TotalOrd > BaseIter < T > for TreeSet < T > {
246238 /// Visit all values in order
239+ #[ inline( always) ]
247240 pure fn each ( & self , f : & fn ( & T ) -> bool ) { self . map . each_key ( f) }
241+ #[ inline( always) ]
248242 pure fn size_hint ( & self ) -> Option < uint > { Some ( self . len ( ) ) }
249243}
250244
251245impl < T : TotalOrd > ReverseIter < T > for TreeSet < T > {
252246 /// Visit all values in reverse order
247+ #[ inline( always) ]
253248 pure fn each_reverse ( & self , f : & fn ( & T ) -> bool ) {
254249 self . map . each_key_reverse ( f)
255250 }
256251}
257252
258253impl < T : Eq + TotalOrd > Eq for TreeSet < T > {
254+ #[ inline( always) ]
259255 pure fn eq ( & self , other : & TreeSet < T > ) -> bool { self . map == other. map }
256+ #[ inline( always) ]
260257 pure fn ne ( & self , other : & TreeSet < T > ) -> bool { self . map != other. map }
261258}
262259
@@ -273,29 +270,35 @@ impl<T: Ord + TotalOrd> Ord for TreeSet<T> {
273270
274271impl < T : TotalOrd > Container for TreeSet < T > {
275272 /// Return the number of elements in the set
273+ #[ inline( always) ]
276274 pure fn len ( & self ) -> uint { self . map . len ( ) }
277275
278276 /// Return true if the set contains no elements
277+ #[ inline( always) ]
279278 pure fn is_empty ( & self ) -> bool { self . map . is_empty ( ) }
280279}
281280
282281impl < T : TotalOrd > Mutable for TreeSet < T > {
283282 /// Clear the set, removing all values.
283+ #[ inline( always) ]
284284 fn clear ( & mut self ) { self . map . clear ( ) }
285285}
286286
287287impl < T : TotalOrd > Set < T > for TreeSet < T > {
288288 /// Return true if the set contains a value
289+ #[ inline( always) ]
289290 pure fn contains ( & self , value : & T ) -> bool {
290291 self . map . contains_key ( value)
291292 }
292293
293294 /// Add a value to the set. Return true if the value was not already
294295 /// present in the set.
296+ #[ inline( always) ]
295297 fn insert ( & mut self , value : T ) -> bool { self . map . insert ( value, ( ) ) }
296298
297299 /// Remove a value from the set. Return true if the value was
298300 /// present in the set.
301+ #[ inline( always) ]
299302 fn remove ( & mut self , value : & T ) -> bool { self . map . remove ( value) }
300303
301304 /// Return true if the set has no elements in common with `other`.
@@ -320,6 +323,7 @@ impl<T: TotalOrd> Set<T> for TreeSet<T> {
320323 }
321324
322325 /// Return true if the set is a subset of another
326+ #[ inline( always) ]
323327 pure fn is_subset ( & self , other : & TreeSet < T > ) -> bool {
324328 other. is_superset ( self )
325329 }
@@ -488,10 +492,12 @@ impl<T: TotalOrd> Set<T> for TreeSet<T> {
488492
489493pub impl < T : TotalOrd > TreeSet < T > {
490494 /// Create an empty TreeSet
495+ #[ inline( always) ]
491496 static pure fn new( ) -> TreeSet <T > { TreeSet { map: TreeMap :: new( ) } }
492497
493498 /// Get a lazy iterator over the values in the set.
494499 /// Requires that it be frozen (immutable).
500+ #[ inline( always) ]
495501 pure fn iter ( & self ) -> TreeSetIterator /& self <T > {
496502 TreeSetIterator { iter: self . map . iter ( ) }
497503 }
@@ -504,11 +510,13 @@ pub struct TreeSetIterator<T> {
504510
505511/// Advance the iterator to the next node (in order). If this iterator is
506512 /// finished, does nothing.
513+ #[ inline( always) ]
507514pub fn set_next<T >( iter: & mut TreeSetIterator /& r<T >) -> Option <& r/T > {
508515 do map_next( & mut iter. iter) . map |& ( value, _) | { value }
509516}
510517
511518/// Advance the iterator through the set
519+ #[ inline( always) ]
512520pub fn set_advance<T >( iter: & mut TreeSetIterator /& r<T >,
513521 f: & fn ( & r/T ) -> bool ) {
514522 do map_advance( & mut iter. iter) |( k, _) | { f( k) }
0 commit comments