@@ -80,18 +80,6 @@ impl<T> Deque<T> for RingBuf<T> {
8080 result
8181 }
8282
83- /// Remove and return the last element in the RingBuf, or None if it is empty
84- #[ deprecated = "use the `pop` method" ]
85- fn pop_back ( & mut self ) -> Option < T > {
86- if self . nelts > 0 {
87- self . nelts -= 1 ;
88- let hi = self . raw_index ( self . nelts ) ;
89- self . elts . get_mut ( hi) . take ( )
90- } else {
91- None
92- }
93- }
94-
9583 /// Prepend an element to the RingBuf
9684 fn push_front ( & mut self , t : T ) {
9785 if self . nelts == self . elts . len ( ) {
@@ -103,22 +91,26 @@ impl<T> Deque<T> for RingBuf<T> {
10391 * self . elts . get_mut ( self . lo ) = Some ( t) ;
10492 self . nelts += 1 u;
10593 }
94+ }
10695
107- /// Append an element to the RingBuf
108- #[ deprecated = "use the `push` method" ]
109- fn push_back ( & mut self , t : T ) {
96+ impl < T > MutableSeq < T > for RingBuf < T > {
97+ fn push ( & mut self , t : T ) {
11098 if self . nelts == self . elts . len ( ) {
11199 grow ( self . nelts , & mut self . lo , & mut self . elts ) ;
112100 }
113101 let hi = self . raw_index ( self . nelts ) ;
114102 * self . elts . get_mut ( hi) = Some ( t) ;
115103 self . nelts += 1 u;
116104 }
117- }
118-
119- impl < T > MutableSeq < T > for RingBuf < T > {
120- fn push ( & mut self , t : T ) { self . push_back ( t) }
121- fn pop ( & mut self ) -> Option < T > { self . pop_back ( ) }
105+ fn pop ( & mut self ) -> Option < T > {
106+ if self . nelts > 0 {
107+ self . nelts -= 1 ;
108+ let hi = self . raw_index ( self . nelts ) ;
109+ self . elts . get_mut ( hi) . take ( )
110+ } else {
111+ None
112+ }
113+ }
122114}
123115
124116impl < T > Default for RingBuf < T > {
0 commit comments