@@ -47,8 +47,8 @@ macro_rules! impl_from {
47
47
#[ doc = $doc]
48
48
impl From <$Small> for $Large {
49
49
#[ inline]
50
- fn from( small: $Small) -> $Large {
51
- small as $Large
50
+ fn from( small: $Small) -> Self {
51
+ small as Self
52
52
}
53
53
}
54
54
} ;
@@ -177,7 +177,7 @@ macro_rules! try_from_unbounded {
177
177
/// is outside of the range of the target type.
178
178
#[ inline]
179
179
fn try_from( value: $source) -> Result <Self , Self :: Error > {
180
- Ok ( value as $target )
180
+ Ok ( value as Self )
181
181
}
182
182
}
183
183
) * }
@@ -194,9 +194,9 @@ macro_rules! try_from_lower_bounded {
194
194
/// number type. This returns an error if the source value
195
195
/// is outside of the range of the target type.
196
196
#[ inline]
197
- fn try_from( u: $source) -> Result <$target , TryFromIntError > {
197
+ fn try_from( u: $source) -> Result <Self , Self :: Error > {
198
198
if u >= 0 {
199
- Ok ( u as $target )
199
+ Ok ( u as Self )
200
200
} else {
201
201
Err ( TryFromIntError ( ( ) ) )
202
202
}
@@ -216,11 +216,11 @@ macro_rules! try_from_upper_bounded {
216
216
/// number type. This returns an error if the source value
217
217
/// is outside of the range of the target type.
218
218
#[ inline]
219
- fn try_from( u: $source) -> Result <$target , TryFromIntError > {
220
- if u > ( <$target> :: max_value( ) as $source) {
219
+ fn try_from( u: $source) -> Result <Self , Self :: Error > {
220
+ if u > ( Self :: max_value( ) as $source) {
221
221
Err ( TryFromIntError ( ( ) ) )
222
222
} else {
223
- Ok ( u as $target )
223
+ Ok ( u as Self )
224
224
}
225
225
}
226
226
}
@@ -238,13 +238,13 @@ macro_rules! try_from_both_bounded {
238
238
/// number type. This returns an error if the source value
239
239
/// is outside of the range of the target type.
240
240
#[ inline]
241
- fn try_from( u: $source) -> Result <$target , TryFromIntError > {
242
- let min = <$target> :: min_value( ) as $source;
243
- let max = <$target> :: max_value( ) as $source;
241
+ fn try_from( u: $source) -> Result <Self , Self :: Error > {
242
+ let min = Self :: min_value( ) as $source;
243
+ let max = Self :: max_value( ) as $source;
244
244
if u < min || u > max {
245
245
Err ( TryFromIntError ( ( ) ) )
246
246
} else {
247
- Ok ( u as $target )
247
+ Ok ( u as Self )
248
248
}
249
249
}
250
250
}
@@ -385,10 +385,10 @@ macro_rules! nzint_impl_from {
385
385
#[ doc = $doc]
386
386
impl From <$Small> for $Large {
387
387
#[ inline]
388
- fn from( small: $Small) -> $Large {
388
+ fn from( small: $Small) -> Self {
389
389
// SAFETY: input type guarantees the value is non-zero
390
390
unsafe {
391
- <$Large> :: new_unchecked( small. get( ) . into( ) )
391
+ Self :: new_unchecked( small. get( ) . into( ) )
392
392
}
393
393
}
394
394
}
0 commit comments