@@ -43,20 +43,20 @@ impl IndexVec {
43
43
/// Returns the number of indices
44
44
#[ inline]
45
45
pub fn len ( & self ) -> usize {
46
- match * self {
47
- IndexVec :: U32 ( ref v) => v. len ( ) ,
46
+ match self {
47
+ IndexVec :: U32 ( v) => v. len ( ) ,
48
48
#[ cfg( target_pointer_width = "64" ) ]
49
- IndexVec :: U64 ( ref v) => v. len ( ) ,
49
+ IndexVec :: U64 ( v) => v. len ( ) ,
50
50
}
51
51
}
52
52
53
53
/// Returns `true` if the length is 0.
54
54
#[ inline]
55
55
pub fn is_empty ( & self ) -> bool {
56
- match * self {
57
- IndexVec :: U32 ( ref v) => v. is_empty ( ) ,
56
+ match self {
57
+ IndexVec :: U32 ( v) => v. is_empty ( ) ,
58
58
#[ cfg( target_pointer_width = "64" ) ]
59
- IndexVec :: U64 ( ref v) => v. is_empty ( ) ,
59
+ IndexVec :: U64 ( v) => v. is_empty ( ) ,
60
60
}
61
61
}
62
62
@@ -66,10 +66,10 @@ impl IndexVec {
66
66
/// restrictions.)
67
67
#[ inline]
68
68
pub fn index ( & self , index : usize ) -> usize {
69
- match * self {
70
- IndexVec :: U32 ( ref v) => v[ index] as usize ,
69
+ match self {
70
+ IndexVec :: U32 ( v) => v[ index] as usize ,
71
71
#[ cfg( target_pointer_width = "64" ) ]
72
- IndexVec :: U64 ( ref v) => v[ index] as usize ,
72
+ IndexVec :: U64 ( v) => v[ index] as usize ,
73
73
}
74
74
}
75
75
@@ -86,10 +86,10 @@ impl IndexVec {
86
86
/// Iterate over the indices as a sequence of `usize` values
87
87
#[ inline]
88
88
pub fn iter ( & self ) -> IndexVecIter < ' _ > {
89
- match * self {
90
- IndexVec :: U32 ( ref v) => IndexVecIter :: U32 ( v. iter ( ) ) ,
89
+ match self {
90
+ IndexVec :: U32 ( v) => IndexVecIter :: U32 ( v. iter ( ) ) ,
91
91
#[ cfg( target_pointer_width = "64" ) ]
92
- IndexVec :: U64 ( ref v) => IndexVecIter :: U64 ( v. iter ( ) ) ,
92
+ IndexVec :: U64 ( v) => IndexVecIter :: U64 ( v. iter ( ) ) ,
93
93
}
94
94
}
95
95
}
@@ -158,17 +158,17 @@ impl<'a> Iterator for IndexVecIter<'a> {
158
158
#[ inline]
159
159
fn next ( & mut self ) -> Option < usize > {
160
160
use self :: IndexVecIter :: * ;
161
- match * self {
162
- U32 ( ref mut iter) => iter. next ( ) . map ( |i| * i as usize ) ,
163
- U64 ( ref mut iter) => iter. next ( ) . map ( |i| * i as usize ) ,
161
+ match self {
162
+ U32 ( iter) => iter. next ( ) . map ( |i| * i as usize ) ,
163
+ U64 ( iter) => iter. next ( ) . map ( |i| * i as usize ) ,
164
164
}
165
165
}
166
166
167
167
#[ inline]
168
168
fn size_hint ( & self ) -> ( usize , Option < usize > ) {
169
- match * self {
170
- IndexVecIter :: U32 ( ref v) => v. size_hint ( ) ,
171
- IndexVecIter :: U64 ( ref v) => v. size_hint ( ) ,
169
+ match self {
170
+ IndexVecIter :: U32 ( v) => v. size_hint ( ) ,
171
+ IndexVecIter :: U64 ( v) => v. size_hint ( ) ,
172
172
}
173
173
}
174
174
}
@@ -190,18 +190,18 @@ impl Iterator for IndexVecIntoIter {
190
190
#[ inline]
191
191
fn next ( & mut self ) -> Option < Self :: Item > {
192
192
use self :: IndexVecIntoIter :: * ;
193
- match * self {
194
- U32 ( ref mut v) => v. next ( ) . map ( |i| i as usize ) ,
195
- U64 ( ref mut v) => v. next ( ) . map ( |i| i as usize ) ,
193
+ match self {
194
+ U32 ( v) => v. next ( ) . map ( |i| i as usize ) ,
195
+ U64 ( v) => v. next ( ) . map ( |i| i as usize ) ,
196
196
}
197
197
}
198
198
199
199
#[ inline]
200
200
fn size_hint ( & self ) -> ( usize , Option < usize > ) {
201
201
use self :: IndexVecIntoIter :: * ;
202
- match * self {
203
- U32 ( ref v) => v. size_hint ( ) ,
204
- U64 ( ref v) => v. size_hint ( ) ,
202
+ match self {
203
+ U32 ( v) => v. size_hint ( ) ,
204
+ U64 ( v) => v. size_hint ( ) ,
205
205
}
206
206
}
207
207
}
@@ -627,6 +627,7 @@ mod test {
627
627
assert ! ( ( i as usize ) < len) ;
628
628
}
629
629
}
630
+ #[ cfg( target_pointer_width = "64" ) ]
630
631
_ => panic ! ( "expected `IndexVec::U32`" ) ,
631
632
}
632
633
}
0 commit comments