mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-22 10:05:06 +03:00
Fix doc example for wrapping_abs
The `max` variable is unused. This change introduces the `min_plus` variable, to make the example similar to the one from `saturating_abs`. An alternative would be to remove the unused variable.
This commit is contained in:
@@ -669,12 +669,15 @@ pub const fn saturating_abs(self) -> $Ty {
|
||||
#[doc = concat!("let neg = ", stringify!($Ty), "::new(-1)?;")]
|
||||
#[doc = concat!("let min = ", stringify!($Ty), "::new(",
|
||||
stringify!($Int), "::MIN)?;")]
|
||||
#[doc = concat!("let min_plus = ", stringify!($Ty), "::new(",
|
||||
stringify!($Int), "::MIN + 1)?;")]
|
||||
#[doc = concat!("let max = ", stringify!($Ty), "::new(",
|
||||
stringify!($Int), "::MAX)?;")]
|
||||
///
|
||||
/// assert_eq!(pos, pos.wrapping_abs());
|
||||
/// assert_eq!(pos, neg.wrapping_abs());
|
||||
/// assert_eq!(min, min.wrapping_abs());
|
||||
/// assert_eq!(max, min_plus.wrapping_abs());
|
||||
/// # // FIXME: add once Neg is implemented?
|
||||
/// # // assert_eq!(max, (-max).wrapping_abs());
|
||||
/// # Some(())
|
||||
|
||||
Reference in New Issue
Block a user