File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
src/librustc_data_structures Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -155,53 +155,63 @@ macro_rules! newtype_index {
155
155
}
156
156
157
157
impl :: std:: iter:: Step for $type {
158
+ #[ inline]
158
159
fn steps_between( start: & Self , end: & Self ) -> Option <usize > {
159
160
<usize as :: std:: iter:: Step >:: steps_between(
160
161
& Idx :: index( * start) ,
161
162
& Idx :: index( * end) ,
162
163
)
163
164
}
164
165
166
+ #[ inline]
165
167
fn replace_one( & mut self ) -> Self {
166
168
:: std:: mem:: replace( self , Self :: new( 1 ) )
167
169
}
168
170
171
+ #[ inline]
169
172
fn replace_zero( & mut self ) -> Self {
170
173
:: std:: mem:: replace( self , Self :: new( 0 ) )
171
174
}
172
175
176
+ #[ inline]
173
177
fn add_one( & self ) -> Self {
174
178
Self :: new( Idx :: index( * self ) + 1 )
175
179
}
176
180
181
+ #[ inline]
177
182
fn sub_one( & self ) -> Self {
178
183
Self :: new( Idx :: index( * self ) - 1 )
179
184
}
180
185
186
+ #[ inline]
181
187
fn add_usize( & self , u: usize ) -> Option <Self > {
182
188
Idx :: index( * self ) . checked_add( u) . map( Self :: new)
183
189
}
184
190
}
185
191
186
192
impl From <$type> for u32 {
193
+ #[ inline]
187
194
fn from( v: $type) -> u32 {
188
195
v. as_u32( )
189
196
}
190
197
}
191
198
192
199
impl From <$type> for usize {
200
+ #[ inline]
193
201
fn from( v: $type) -> usize {
194
202
v. as_usize( )
195
203
}
196
204
}
197
205
198
206
impl From <usize > for $type {
207
+ #[ inline]
199
208
fn from( value: usize ) -> Self {
200
209
$type:: from_usize( value)
201
210
}
202
211
}
203
212
204
213
impl From <u32 > for $type {
214
+ #[ inline]
205
215
fn from( value: u32 ) -> Self {
206
216
$type:: from_u32( value)
207
217
}
You can’t perform that action at this time.
0 commit comments