Make documentation examples use new integer assoc consts

This commit is contained in:
Linus Färnstrand 2020-03-27 22:43:28 +01:00
parent 548afdbe1a
commit e9ce03648d
5 changed files with 6 additions and 6 deletions

View File

@ -43,7 +43,7 @@
///
/// assert_eq!(div_1(7, 0), 7);
/// assert_eq!(div_1(9, 1), 4);
/// assert_eq!(div_1(11, std::u32::MAX), 0);
/// assert_eq!(div_1(11, u32::MAX), 0);
/// ```
#[inline]
#[stable(feature = "unreachable", since = "1.27.0")]

View File

@ -470,7 +470,7 @@ pub fn min(self, other: f32) -> f32 {
///
/// let value = -128.9_f32;
/// let rounded = unsafe { value.to_int_unchecked::<i8>() };
/// assert_eq!(rounded, std::i8::MIN);
/// assert_eq!(rounded, i8::MIN);
/// ```
///
/// # Safety

View File

@ -484,7 +484,7 @@ pub fn min(self, other: f64) -> f64 {
///
/// let value = -128.9_f32;
/// let rounded = unsafe { value.to_int_unchecked::<i8>() };
/// assert_eq!(rounded, std::i8::MIN);
/// assert_eq!(rounded, i8::MIN);
/// ```
///
/// # Safety

View File

@ -174,7 +174,7 @@ fn from_str(src: &str) -> Result<Self, Self::Err> {
/// let zero = Wrapping(0u32);
/// let one = Wrapping(1u32);
///
/// assert_eq!(std::u32::MAX, (zero - one).0);
/// assert_eq!(u32::MAX, (zero - one).0);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Default, Hash)]

View File

@ -389,7 +389,7 @@ pub const fn as_nanos(&self) -> u128 {
/// use std::time::Duration;
///
/// assert_eq!(Duration::new(0, 0).checked_add(Duration::new(0, 1)), Some(Duration::new(0, 1)));
/// assert_eq!(Duration::new(1, 0).checked_add(Duration::new(std::u64::MAX, 0)), None);
/// assert_eq!(Duration::new(1, 0).checked_add(Duration::new(u64::MAX, 0)), None);
/// ```
#[stable(feature = "duration_checked_ops", since = "1.16.0")]
#[inline]
@ -460,7 +460,7 @@ pub fn checked_sub(self, rhs: Duration) -> Option<Duration> {
/// use std::time::Duration;
///
/// assert_eq!(Duration::new(0, 500_000_001).checked_mul(2), Some(Duration::new(1, 2)));
/// assert_eq!(Duration::new(std::u64::MAX - 1, 0).checked_mul(2), None);
/// assert_eq!(Duration::new(u64::MAX - 1, 0).checked_mul(2), None);
/// ```
#[stable(feature = "duration_checked_ops", since = "1.16.0")]
#[inline]