@@ -501,7 +501,7 @@ macro_rules! int_impl {
501501 unsafe { intrinsics:: unchecked_sub( self , rhs) }
502502 }
503503
504- /// Checked addition with an unsigned integer. Computes `self + rhs`,
504+ /// Checked subtraction with an unsigned integer. Computes `self - rhs`,
505505 /// returning `None` if overflow occurred.
506506 ///
507507 /// # Examples
@@ -885,10 +885,7 @@ macro_rules! int_impl {
885885 #[ inline]
886886 pub const fn saturating_add_unsigned( self , rhs: $UnsignedT) -> Self {
887887 // Overflow can only happen at the upper bound
888- match self . checked_add_unsigned( rhs) {
889- Some ( x) => x,
890- None => Self :: MAX ,
891- }
888+ self . checked_add_unsigned( rhs) . unwrap_or( Self :: MAX )
892889 }
893890
894891 /// Saturating integer subtraction. Computes `self - rhs`, saturating at the
@@ -912,7 +909,7 @@ macro_rules! int_impl {
912909 intrinsics:: saturating_sub( self , rhs)
913910 }
914911
915- /// Saturating substraction with an unsigned integer. Computes `self - rhs`,
912+ /// Saturating subtraction with an unsigned integer. Computes `self - rhs`,
916913 /// saturating at the numeric bounds instead of overflowing.
917914 ///
918915 /// # Examples
@@ -931,10 +928,7 @@ macro_rules! int_impl {
931928 #[ inline]
932929 pub const fn saturating_sub_unsigned( self , rhs: $UnsignedT) -> Self {
933930 // Overflow can only happen at the lower bound
934- match self . checked_sub_unsigned( rhs) {
935- Some ( x) => x,
936- None => Self :: MIN ,
937- }
931+ self . checked_sub_unsigned( rhs) . unwrap_or( Self :: MIN )
938932 }
939933
940934 /// Saturating integer negation. Computes `-self`, returning `MAX` if `self == MIN`
@@ -1133,7 +1127,7 @@ macro_rules! int_impl {
11331127 intrinsics:: wrapping_sub( self , rhs)
11341128 }
11351129
1136- /// Wrapping (modular) substraction with an unsigned integer. Computes
1130+ /// Wrapping (modular) subtraction with an unsigned integer. Computes
11371131 /// `self - rhs`, wrapping around at the boundary of the type.
11381132 ///
11391133 /// # Examples
@@ -1584,7 +1578,7 @@ macro_rules! int_impl {
15841578
15851579 /// Calculates `self` - `rhs` with an unsigned `rhs`
15861580 ///
1587- /// Returns a tuple of the substraction along with a boolean indicating
1581+ /// Returns a tuple of the subtraction along with a boolean indicating
15881582 /// whether an arithmetic overflow would occur. If an overflow would
15891583 /// have occurred then the wrapped value is returned.
15901584 ///
0 commit comments