@@ -47,8 +47,8 @@ macro_rules! impl_from {
4747 #[ doc = $doc]
4848 impl From <$Small> for $Large {
4949 #[ inline]
50- fn from( small: $Small) -> $Large {
51- small as $Large
50+ fn from( small: $Small) -> Self {
51+ small as Self
5252 }
5353 }
5454 } ;
@@ -177,7 +177,7 @@ macro_rules! try_from_unbounded {
177177 /// is outside of the range of the target type.
178178 #[ inline]
179179 fn try_from( value: $source) -> Result <Self , Self :: Error > {
180- Ok ( value as $target )
180+ Ok ( value as Self )
181181 }
182182 }
183183 ) * }
@@ -194,9 +194,9 @@ macro_rules! try_from_lower_bounded {
194194 /// number type. This returns an error if the source value
195195 /// is outside of the range of the target type.
196196 #[ inline]
197- fn try_from( u: $source) -> Result <$target , TryFromIntError > {
197+ fn try_from( u: $source) -> Result <Self , Self :: Error > {
198198 if u >= 0 {
199- Ok ( u as $target )
199+ Ok ( u as Self )
200200 } else {
201201 Err ( TryFromIntError ( ( ) ) )
202202 }
@@ -216,11 +216,11 @@ macro_rules! try_from_upper_bounded {
216216 /// number type. This returns an error if the source value
217217 /// is outside of the range of the target type.
218218 #[ 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) {
221221 Err ( TryFromIntError ( ( ) ) )
222222 } else {
223- Ok ( u as $target )
223+ Ok ( u as Self )
224224 }
225225 }
226226 }
@@ -238,13 +238,13 @@ macro_rules! try_from_both_bounded {
238238 /// number type. This returns an error if the source value
239239 /// is outside of the range of the target type.
240240 #[ 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;
244244 if u < min || u > max {
245245 Err ( TryFromIntError ( ( ) ) )
246246 } else {
247- Ok ( u as $target )
247+ Ok ( u as Self )
248248 }
249249 }
250250 }
@@ -385,10 +385,10 @@ macro_rules! nzint_impl_from {
385385 #[ doc = $doc]
386386 impl From <$Small> for $Large {
387387 #[ inline]
388- fn from( small: $Small) -> $Large {
388+ fn from( small: $Small) -> Self {
389389 // SAFETY: input type guarantees the value is non-zero
390390 unsafe {
391- <$Large> :: new_unchecked( small. get( ) . into( ) )
391+ Self :: new_unchecked( small. get( ) . into( ) )
392392 }
393393 }
394394 }
0 commit comments