@@ -380,7 +380,7 @@ macro_rules! int_impl {
380
380
if cfg!( target_endian = "little" ) { self } else { self . swap_bytes( ) }
381
381
}
382
382
383
- /// Checked integer addition. Computes `self + other `, returning `None`
383
+ /// Checked integer addition. Computes `self + rhs `, returning `None`
384
384
/// if overflow occurred.
385
385
///
386
386
/// # Examples
@@ -393,12 +393,12 @@ macro_rules! int_impl {
393
393
/// ```
394
394
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
395
395
#[ inline]
396
- pub fn checked_add( self , other : Self ) -> Option <Self > {
397
- let ( a, b) = self . overflowing_add( other ) ;
396
+ pub fn checked_add( self , rhs : Self ) -> Option <Self > {
397
+ let ( a, b) = self . overflowing_add( rhs ) ;
398
398
if b { None } else { Some ( a) }
399
399
}
400
400
401
- /// Checked integer subtraction. Computes `self - other `, returning
401
+ /// Checked integer subtraction. Computes `self - rhs `, returning
402
402
/// `None` if underflow occurred.
403
403
///
404
404
/// # Examples
@@ -411,12 +411,12 @@ macro_rules! int_impl {
411
411
/// ```
412
412
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
413
413
#[ inline]
414
- pub fn checked_sub( self , other : Self ) -> Option <Self > {
415
- let ( a, b) = self . overflowing_sub( other ) ;
414
+ pub fn checked_sub( self , rhs : Self ) -> Option <Self > {
415
+ let ( a, b) = self . overflowing_sub( rhs ) ;
416
416
if b { None } else { Some ( a) }
417
417
}
418
418
419
- /// Checked integer multiplication. Computes `self * other `, returning
419
+ /// Checked integer multiplication. Computes `self * rhs `, returning
420
420
/// `None` if underflow or overflow occurred.
421
421
///
422
422
/// # Examples
@@ -429,13 +429,13 @@ macro_rules! int_impl {
429
429
/// ```
430
430
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
431
431
#[ inline]
432
- pub fn checked_mul( self , other : Self ) -> Option <Self > {
433
- let ( a, b) = self . overflowing_mul( other ) ;
432
+ pub fn checked_mul( self , rhs : Self ) -> Option <Self > {
433
+ let ( a, b) = self . overflowing_mul( rhs ) ;
434
434
if b { None } else { Some ( a) }
435
435
}
436
436
437
- /// Checked integer division. Computes `self / other `, returning `None`
438
- /// if `other == 0` or the operation results in underflow or overflow.
437
+ /// Checked integer division. Computes `self / rhs `, returning `None`
438
+ /// if `rhs == 0` or the operation results in underflow or overflow.
439
439
///
440
440
/// # Examples
441
441
///
@@ -448,16 +448,16 @@ macro_rules! int_impl {
448
448
/// ```
449
449
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
450
450
#[ inline]
451
- pub fn checked_div( self , other : Self ) -> Option <Self > {
452
- if other == 0 || ( self == Self :: min_value( ) && other == -1 ) {
451
+ pub fn checked_div( self , rhs : Self ) -> Option <Self > {
452
+ if rhs == 0 || ( self == Self :: min_value( ) && rhs == -1 ) {
453
453
None
454
454
} else {
455
- Some ( unsafe { intrinsics:: unchecked_div( self , other ) } )
455
+ Some ( unsafe { intrinsics:: unchecked_div( self , rhs ) } )
456
456
}
457
457
}
458
458
459
- /// Checked integer remainder. Computes `self % other `, returning `None`
460
- /// if `other == 0` or the operation results in underflow or overflow.
459
+ /// Checked integer remainder. Computes `self % rhs `, returning `None`
460
+ /// if `rhs == 0` or the operation results in underflow or overflow.
461
461
///
462
462
/// # Examples
463
463
///
@@ -472,11 +472,11 @@ macro_rules! int_impl {
472
472
/// ```
473
473
#[ stable( feature = "wrapping" , since = "1.7.0" ) ]
474
474
#[ inline]
475
- pub fn checked_rem( self , other : Self ) -> Option <Self > {
476
- if other == 0 || ( self == Self :: min_value( ) && other == -1 ) {
475
+ pub fn checked_rem( self , rhs : Self ) -> Option <Self > {
476
+ if rhs == 0 || ( self == Self :: min_value( ) && rhs == -1 ) {
477
477
None
478
478
} else {
479
- Some ( unsafe { intrinsics:: unchecked_rem( self , other ) } )
479
+ Some ( unsafe { intrinsics:: unchecked_rem( self , rhs ) } )
480
480
}
481
481
}
482
482
@@ -559,7 +559,7 @@ macro_rules! int_impl {
559
559
}
560
560
}
561
561
562
- /// Saturating integer addition. Computes `self + other `, saturating at
562
+ /// Saturating integer addition. Computes `self + rhs `, saturating at
563
563
/// the numeric bounds instead of overflowing.
564
564
///
565
565
/// # Examples
@@ -572,15 +572,15 @@ macro_rules! int_impl {
572
572
/// ```
573
573
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
574
574
#[ inline]
575
- pub fn saturating_add( self , other : Self ) -> Self {
576
- match self . checked_add( other ) {
575
+ pub fn saturating_add( self , rhs : Self ) -> Self {
576
+ match self . checked_add( rhs ) {
577
577
Some ( x) => x,
578
- None if other >= 0 => Self :: max_value( ) ,
578
+ None if rhs >= 0 => Self :: max_value( ) ,
579
579
None => Self :: min_value( ) ,
580
580
}
581
581
}
582
582
583
- /// Saturating integer subtraction. Computes `self - other `, saturating
583
+ /// Saturating integer subtraction. Computes `self - rhs `, saturating
584
584
/// at the numeric bounds instead of overflowing.
585
585
///
586
586
/// # Examples
@@ -593,15 +593,15 @@ macro_rules! int_impl {
593
593
/// ```
594
594
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
595
595
#[ inline]
596
- pub fn saturating_sub( self , other : Self ) -> Self {
597
- match self . checked_sub( other ) {
596
+ pub fn saturating_sub( self , rhs : Self ) -> Self {
597
+ match self . checked_sub( rhs ) {
598
598
Some ( x) => x,
599
- None if other >= 0 => Self :: min_value( ) ,
599
+ None if rhs >= 0 => Self :: min_value( ) ,
600
600
None => Self :: max_value( ) ,
601
601
}
602
602
}
603
603
604
- /// Saturating integer multiplication. Computes `self * other `,
604
+ /// Saturating integer multiplication. Computes `self * rhs `,
605
605
/// saturating at the numeric bounds instead of overflowing.
606
606
///
607
607
/// # Examples
@@ -617,17 +617,17 @@ macro_rules! int_impl {
617
617
/// ```
618
618
#[ stable( feature = "wrapping" , since = "1.7.0" ) ]
619
619
#[ inline]
620
- pub fn saturating_mul( self , other : Self ) -> Self {
621
- self . checked_mul( other ) . unwrap_or_else( || {
622
- if ( self < 0 && other < 0 ) || ( self > 0 && other > 0 ) {
620
+ pub fn saturating_mul( self , rhs : Self ) -> Self {
621
+ self . checked_mul( rhs ) . unwrap_or_else( || {
622
+ if ( self < 0 && rhs < 0 ) || ( self > 0 && rhs > 0 ) {
623
623
Self :: max_value( )
624
624
} else {
625
625
Self :: min_value( )
626
626
}
627
627
} )
628
628
}
629
629
630
- /// Wrapping (modular) addition. Computes `self + other `,
630
+ /// Wrapping (modular) addition. Computes `self + rhs `,
631
631
/// wrapping around at the boundary of the type.
632
632
///
633
633
/// # Examples
@@ -646,7 +646,7 @@ macro_rules! int_impl {
646
646
}
647
647
}
648
648
649
- /// Wrapping (modular) subtraction. Computes `self - other `,
649
+ /// Wrapping (modular) subtraction. Computes `self - rhs `,
650
650
/// wrapping around at the boundary of the type.
651
651
///
652
652
/// # Examples
@@ -666,7 +666,7 @@ macro_rules! int_impl {
666
666
}
667
667
668
668
/// Wrapping (modular) multiplication. Computes `self *
669
- /// other `, wrapping around at the boundary of the type.
669
+ /// rhs `, wrapping around at the boundary of the type.
670
670
///
671
671
/// # Examples
672
672
///
@@ -684,7 +684,7 @@ macro_rules! int_impl {
684
684
}
685
685
}
686
686
687
- /// Wrapping (modular) division. Computes `self / other `,
687
+ /// Wrapping (modular) division. Computes `self / rhs `,
688
688
/// wrapping around at the boundary of the type.
689
689
///
690
690
/// The only case where such wrapping can occur is when one
@@ -712,7 +712,7 @@ macro_rules! int_impl {
712
712
self . overflowing_div( rhs) . 0
713
713
}
714
714
715
- /// Wrapping (modular) remainder. Computes `self % other `,
715
+ /// Wrapping (modular) remainder. Computes `self % rhs `,
716
716
/// wrapping around at the boundary of the type.
717
717
///
718
718
/// Such wrap-around never actually occurs mathematically;
@@ -1573,7 +1573,7 @@ macro_rules! uint_impl {
1573
1573
if cfg!( target_endian = "little" ) { self } else { self . swap_bytes( ) }
1574
1574
}
1575
1575
1576
- /// Checked integer addition. Computes `self + other `, returning `None`
1576
+ /// Checked integer addition. Computes `self + rhs `, returning `None`
1577
1577
/// if overflow occurred.
1578
1578
///
1579
1579
/// # Examples
@@ -1586,12 +1586,12 @@ macro_rules! uint_impl {
1586
1586
/// ```
1587
1587
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1588
1588
#[ inline]
1589
- pub fn checked_add( self , other : Self ) -> Option <Self > {
1590
- let ( a, b) = self . overflowing_add( other ) ;
1589
+ pub fn checked_add( self , rhs : Self ) -> Option <Self > {
1590
+ let ( a, b) = self . overflowing_add( rhs ) ;
1591
1591
if b { None } else { Some ( a) }
1592
1592
}
1593
1593
1594
- /// Checked integer subtraction. Computes `self - other `, returning
1594
+ /// Checked integer subtraction. Computes `self - rhs `, returning
1595
1595
/// `None` if underflow occurred.
1596
1596
///
1597
1597
/// # Examples
@@ -1604,12 +1604,12 @@ macro_rules! uint_impl {
1604
1604
/// ```
1605
1605
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1606
1606
#[ inline]
1607
- pub fn checked_sub( self , other : Self ) -> Option <Self > {
1608
- let ( a, b) = self . overflowing_sub( other ) ;
1607
+ pub fn checked_sub( self , rhs : Self ) -> Option <Self > {
1608
+ let ( a, b) = self . overflowing_sub( rhs ) ;
1609
1609
if b { None } else { Some ( a) }
1610
1610
}
1611
1611
1612
- /// Checked integer multiplication. Computes `self * other `, returning
1612
+ /// Checked integer multiplication. Computes `self * rhs `, returning
1613
1613
/// `None` if underflow or overflow occurred.
1614
1614
///
1615
1615
/// # Examples
@@ -1622,13 +1622,13 @@ macro_rules! uint_impl {
1622
1622
/// ```
1623
1623
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1624
1624
#[ inline]
1625
- pub fn checked_mul( self , other : Self ) -> Option <Self > {
1626
- let ( a, b) = self . overflowing_mul( other ) ;
1625
+ pub fn checked_mul( self , rhs : Self ) -> Option <Self > {
1626
+ let ( a, b) = self . overflowing_mul( rhs ) ;
1627
1627
if b { None } else { Some ( a) }
1628
1628
}
1629
1629
1630
- /// Checked integer division. Computes `self / other `, returning `None`
1631
- /// if `other == 0` or the operation results in underflow or overflow.
1630
+ /// Checked integer division. Computes `self / rhs `, returning `None`
1631
+ /// if `rhs == 0` or the operation results in underflow or overflow.
1632
1632
///
1633
1633
/// # Examples
1634
1634
///
@@ -1640,15 +1640,15 @@ macro_rules! uint_impl {
1640
1640
/// ```
1641
1641
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1642
1642
#[ inline]
1643
- pub fn checked_div( self , other : Self ) -> Option <Self > {
1644
- match other {
1643
+ pub fn checked_div( self , rhs : Self ) -> Option <Self > {
1644
+ match rhs {
1645
1645
0 => None ,
1646
- other => Some ( unsafe { intrinsics:: unchecked_div( self , other ) } ) ,
1646
+ rhs => Some ( unsafe { intrinsics:: unchecked_div( self , rhs ) } ) ,
1647
1647
}
1648
1648
}
1649
1649
1650
- /// Checked integer remainder. Computes `self % other `, returning `None`
1651
- /// if `other == 0` or the operation results in underflow or overflow.
1650
+ /// Checked integer remainder. Computes `self % rhs `, returning `None`
1651
+ /// if `rhs == 0` or the operation results in underflow or overflow.
1652
1652
///
1653
1653
/// # Examples
1654
1654
///
@@ -1660,11 +1660,11 @@ macro_rules! uint_impl {
1660
1660
/// ```
1661
1661
#[ stable( feature = "wrapping" , since = "1.7.0" ) ]
1662
1662
#[ inline]
1663
- pub fn checked_rem( self , other : Self ) -> Option <Self > {
1664
- if other == 0 {
1663
+ pub fn checked_rem( self , rhs : Self ) -> Option <Self > {
1664
+ if rhs == 0 {
1665
1665
None
1666
1666
} else {
1667
- Some ( unsafe { intrinsics:: unchecked_rem( self , other ) } )
1667
+ Some ( unsafe { intrinsics:: unchecked_rem( self , rhs ) } )
1668
1668
}
1669
1669
}
1670
1670
@@ -1724,7 +1724,7 @@ macro_rules! uint_impl {
1724
1724
if b { None } else { Some ( a) }
1725
1725
}
1726
1726
1727
- /// Saturating integer addition. Computes `self + other `, saturating at
1727
+ /// Saturating integer addition. Computes `self + rhs `, saturating at
1728
1728
/// the numeric bounds instead of overflowing.
1729
1729
///
1730
1730
/// # Examples
@@ -1737,14 +1737,14 @@ macro_rules! uint_impl {
1737
1737
/// ```
1738
1738
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1739
1739
#[ inline]
1740
- pub fn saturating_add( self , other : Self ) -> Self {
1741
- match self . checked_add( other ) {
1740
+ pub fn saturating_add( self , rhs : Self ) -> Self {
1741
+ match self . checked_add( rhs ) {
1742
1742
Some ( x) => x,
1743
1743
None => Self :: max_value( ) ,
1744
1744
}
1745
1745
}
1746
1746
1747
- /// Saturating integer subtraction. Computes `self - other `, saturating
1747
+ /// Saturating integer subtraction. Computes `self - rhs `, saturating
1748
1748
/// at the numeric bounds instead of overflowing.
1749
1749
///
1750
1750
/// # Examples
@@ -1757,14 +1757,14 @@ macro_rules! uint_impl {
1757
1757
/// ```
1758
1758
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1759
1759
#[ inline]
1760
- pub fn saturating_sub( self , other : Self ) -> Self {
1761
- match self . checked_sub( other ) {
1760
+ pub fn saturating_sub( self , rhs : Self ) -> Self {
1761
+ match self . checked_sub( rhs ) {
1762
1762
Some ( x) => x,
1763
1763
None => Self :: min_value( ) ,
1764
1764
}
1765
1765
}
1766
1766
1767
- /// Saturating integer multiplication. Computes `self * other `,
1767
+ /// Saturating integer multiplication. Computes `self * rhs `,
1768
1768
/// saturating at the numeric bounds instead of overflowing.
1769
1769
///
1770
1770
/// # Examples
@@ -1779,11 +1779,11 @@ macro_rules! uint_impl {
1779
1779
/// ```
1780
1780
#[ stable( feature = "wrapping" , since = "1.7.0" ) ]
1781
1781
#[ inline]
1782
- pub fn saturating_mul( self , other : Self ) -> Self {
1783
- self . checked_mul( other ) . unwrap_or( Self :: max_value( ) )
1782
+ pub fn saturating_mul( self , rhs : Self ) -> Self {
1783
+ self . checked_mul( rhs ) . unwrap_or( Self :: max_value( ) )
1784
1784
}
1785
1785
1786
- /// Wrapping (modular) addition. Computes `self + other `,
1786
+ /// Wrapping (modular) addition. Computes `self + rhs `,
1787
1787
/// wrapping around at the boundary of the type.
1788
1788
///
1789
1789
/// # Examples
@@ -1802,7 +1802,7 @@ macro_rules! uint_impl {
1802
1802
}
1803
1803
}
1804
1804
1805
- /// Wrapping (modular) subtraction. Computes `self - other `,
1805
+ /// Wrapping (modular) subtraction. Computes `self - rhs `,
1806
1806
/// wrapping around at the boundary of the type.
1807
1807
///
1808
1808
/// # Examples
@@ -1822,7 +1822,7 @@ macro_rules! uint_impl {
1822
1822
}
1823
1823
1824
1824
/// Wrapping (modular) multiplication. Computes `self *
1825
- /// other `, wrapping around at the boundary of the type.
1825
+ /// rhs `, wrapping around at the boundary of the type.
1826
1826
///
1827
1827
/// # Examples
1828
1828
///
@@ -1840,7 +1840,7 @@ macro_rules! uint_impl {
1840
1840
}
1841
1841
}
1842
1842
1843
- /// Wrapping (modular) division. Computes `self / other `.
1843
+ /// Wrapping (modular) division. Computes `self / rhs `.
1844
1844
/// Wrapped division on unsigned types is just normal division.
1845
1845
/// There's no way wrapping could ever happen.
1846
1846
/// This function exists, so that all operations
@@ -1859,7 +1859,7 @@ macro_rules! uint_impl {
1859
1859
self / rhs
1860
1860
}
1861
1861
1862
- /// Wrapping (modular) remainder. Computes `self % other `.
1862
+ /// Wrapping (modular) remainder. Computes `self % rhs `.
1863
1863
/// Wrapped remainder calculation on unsigned types is
1864
1864
/// just the regular remainder calculation.
1865
1865
/// There's no way wrapping could ever happen.
0 commit comments