@@ -64,7 +64,7 @@ pub struct Iter<'a, T:'a> {
64
64
// FIXME #19839: deriving is too aggressive on the bounds (T doesn't need to be Clone).
65
65
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
66
66
impl < ' a , T > Clone for Iter < ' a , T > {
67
- fn clone ( & self ) -> Iter < ' a , T > {
67
+ fn clone ( & self ) -> Self {
68
68
Iter {
69
69
head : self . head . clone ( ) ,
70
70
tail : self . tail ,
@@ -92,12 +92,12 @@ pub struct IntoIter<T> {
92
92
/// Rawlink is a type like Option<T> but for holding a raw pointer
93
93
impl < T > Rawlink < T > {
94
94
/// Like Option::None for Rawlink
95
- fn none ( ) -> Rawlink < T > {
95
+ fn none ( ) -> Self {
96
96
Rawlink { p : ptr:: null_mut ( ) }
97
97
}
98
98
99
99
/// Like Option::Some for Rawlink
100
- fn some ( n : & mut T ) -> Rawlink < T > {
100
+ fn some ( n : & mut T ) -> Self {
101
101
Rawlink { p : n}
102
102
}
103
103
@@ -122,7 +122,7 @@ impl<T> Rawlink<T> {
122
122
}
123
123
124
124
/// Return the `Rawlink` and replace with `Rawlink::none()`
125
- fn take ( & mut self ) -> Rawlink < T > {
125
+ fn take ( & mut self ) -> Self {
126
126
mem:: replace ( self , Rawlink :: none ( ) )
127
127
}
128
128
}
@@ -138,13 +138,13 @@ impl<'a, T> From<&'a mut Link<T>> for Rawlink<Node<T>> {
138
138
139
139
impl < T > Clone for Rawlink < T > {
140
140
#[ inline]
141
- fn clone ( & self ) -> Rawlink < T > {
141
+ fn clone ( & self ) -> Self {
142
142
Rawlink { p : self . p }
143
143
}
144
144
}
145
145
146
146
impl < T > Node < T > {
147
- fn new ( v : T ) -> Node < T > {
147
+ fn new ( v : T ) -> Self {
148
148
Node { value : v, next : None , prev : Rawlink :: none ( ) }
149
149
}
150
150
@@ -187,7 +187,7 @@ impl<T> LinkedList<T> {
187
187
188
188
/// Remove the first Node and return it, or None if the list is empty
189
189
#[ inline]
190
- fn pop_front_node ( & mut self ) -> Option < Box < Node < T > > > {
190
+ fn pop_front_node ( & mut self ) -> Link < T > {
191
191
self . list_head . take ( ) . map ( |mut front_node| {
192
192
self . length -= 1 ;
193
193
match front_node. next . take ( ) {
@@ -213,7 +213,7 @@ impl<T> LinkedList<T> {
213
213
214
214
/// Remove the last Node and return it, or None if the list is empty
215
215
#[ inline]
216
- fn pop_back_node ( & mut self ) -> Option < Box < Node < T > > > {
216
+ fn pop_back_node ( & mut self ) -> Link < T > {
217
217
unsafe {
218
218
self . list_tail . resolve_mut ( ) . and_then ( |tail| {
219
219
self . length -= 1 ;
@@ -230,14 +230,14 @@ impl<T> LinkedList<T> {
230
230
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
231
231
impl < T > Default for LinkedList < T > {
232
232
#[ inline]
233
- fn default ( ) -> LinkedList < T > { LinkedList :: new ( ) }
233
+ fn default ( ) -> Self { LinkedList :: new ( ) }
234
234
}
235
235
236
236
impl < T > LinkedList < T > {
237
237
/// Creates an empty `LinkedList`.
238
238
#[ inline]
239
239
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
240
- pub fn new ( ) -> LinkedList < T > {
240
+ pub fn new ( ) -> Self {
241
241
LinkedList { list_head : None , list_tail : Rawlink :: none ( ) , length : 0 }
242
242
}
243
243
@@ -268,7 +268,7 @@ impl<T> LinkedList<T> {
268
268
/// println!("{}", b.len()); // prints 0
269
269
/// ```
270
270
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
271
- pub fn append ( & mut self , other : & mut LinkedList < T > ) {
271
+ pub fn append ( & mut self , other : & mut Self ) {
272
272
match unsafe { self . list_tail . resolve_mut ( ) } {
273
273
None => {
274
274
self . length = other. length ;
@@ -597,7 +597,7 @@ impl<T> LinkedList<T> {
597
597
/// assert_eq!(splitted.pop_front(), None);
598
598
/// ```
599
599
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
600
- pub fn split_off ( & mut self , at : usize ) -> LinkedList < T > {
600
+ pub fn split_off ( & mut self , at : usize ) -> Self {
601
601
let len = self . len ( ) ;
602
602
assert ! ( at <= len, "Cannot split off at a nonexistent index" ) ;
603
603
if at == 0 {
@@ -672,7 +672,7 @@ impl<'a, A> Iterator for Iter<'a, A> {
672
672
type Item = & ' a A ;
673
673
674
674
#[ inline]
675
- fn next ( & mut self ) -> Option < & ' a A > {
675
+ fn next ( & mut self ) -> Option < Self :: Item > {
676
676
if self . nelem == 0 {
677
677
return None ;
678
678
}
@@ -713,7 +713,7 @@ impl<'a, A> ExactSizeIterator for Iter<'a, A> {}
713
713
impl < ' a , A > Iterator for IterMut < ' a , A > {
714
714
type Item = & ' a mut A ;
715
715
#[ inline]
716
- fn next ( & mut self ) -> Option < & ' a mut A > {
716
+ fn next ( & mut self ) -> Option < Self :: Item > {
717
717
if self . nelem == 0 {
718
718
return None ;
719
719
}
@@ -843,7 +843,7 @@ impl<A> Iterator for IntoIter<A> {
843
843
type Item = A ;
844
844
845
845
#[ inline]
846
- fn next ( & mut self ) -> Option < A > { self . list . pop_front ( ) }
846
+ fn next ( & mut self ) -> Option < Self :: Item > { self . list . pop_front ( ) }
847
847
848
848
#[ inline]
849
849
fn size_hint ( & self ) -> ( usize , Option < usize > ) {
@@ -862,7 +862,7 @@ impl<A> ExactSizeIterator for IntoIter<A> {}
862
862
863
863
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
864
864
impl < A > FromIterator < A > for LinkedList < A > {
865
- fn from_iter < T : IntoIterator < Item =A > > ( iter : T ) -> LinkedList < A > {
865
+ fn from_iter < T : IntoIterator < Item =A > > ( iter : T ) -> Self {
866
866
let mut ret = LinkedList :: new ( ) ;
867
867
ret. extend ( iter) ;
868
868
ret
@@ -872,11 +872,11 @@ impl<A> FromIterator<A> for LinkedList<A> {
872
872
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
873
873
impl < T > IntoIterator for LinkedList < T > {
874
874
type Item = T ;
875
- type IntoIter = IntoIter < T > ;
875
+ type IntoIter = IntoIter < Self :: Item > ;
876
876
877
877
/// Consumes the list into an iterator yielding elements by value.
878
878
#[ inline]
879
- fn into_iter ( self ) -> IntoIter < T > {
879
+ fn into_iter ( self ) -> Self :: IntoIter {
880
880
IntoIter { list : self }
881
881
}
882
882
}
@@ -886,7 +886,7 @@ impl<'a, T> IntoIterator for &'a LinkedList<T> {
886
886
type Item = & ' a T ;
887
887
type IntoIter = Iter < ' a , T > ;
888
888
889
- fn into_iter ( self ) -> Iter < ' a , T > {
889
+ fn into_iter ( self ) -> Self :: IntoIter {
890
890
self . iter ( )
891
891
}
892
892
}
@@ -896,7 +896,7 @@ impl<'a, T> IntoIterator for &'a mut LinkedList<T> {
896
896
type Item = & ' a mut T ;
897
897
type IntoIter = IterMut < ' a , T > ;
898
898
899
- fn into_iter ( mut self ) -> IterMut < ' a , T > {
899
+ fn into_iter ( mut self ) -> Self :: IntoIter {
900
900
self . iter_mut ( )
901
901
}
902
902
}
@@ -917,7 +917,7 @@ impl<'a, T: 'a + Copy> Extend<&'a T> for LinkedList<T> {
917
917
918
918
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
919
919
impl < A : PartialEq > PartialEq for LinkedList < A > {
920
- fn eq ( & self , other : & LinkedList < A > ) -> bool {
920
+ fn eq ( & self , other : & Self ) -> bool {
921
921
self . len ( ) == other. len ( ) &&
922
922
self . iter ( ) . eq ( other. iter ( ) )
923
923
}
@@ -933,7 +933,7 @@ impl<A: Eq> Eq for LinkedList<A> {}
933
933
934
934
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
935
935
impl < A : PartialOrd > PartialOrd for LinkedList < A > {
936
- fn partial_cmp ( & self , other : & LinkedList < A > ) -> Option < Ordering > {
936
+ fn partial_cmp ( & self , other : & Self ) -> Option < Ordering > {
937
937
self . iter ( ) . partial_cmp ( other. iter ( ) )
938
938
}
939
939
}
@@ -948,7 +948,7 @@ impl<A: Ord> Ord for LinkedList<A> {
948
948
949
949
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
950
950
impl < A : Clone > Clone for LinkedList < A > {
951
- fn clone ( & self ) -> LinkedList < A > {
951
+ fn clone ( & self ) -> Self {
952
952
self . iter ( ) . cloned ( ) . collect ( )
953
953
}
954
954
}
0 commit comments