Skip to content

Commit 089475a

Browse files
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.
1 parent 96ddd32 commit 089475a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

library/core/src/num/nonzero.rs

+3
Original file line numberDiff line numberDiff line change
@@ -669,12 +669,15 @@ macro_rules! nonzero_signed_operations {
669669
#[doc = concat!("let neg = ", stringify!($Ty), "::new(-1)?;")]
670670
#[doc = concat!("let min = ", stringify!($Ty), "::new(",
671671
stringify!($Int), "::MIN)?;")]
672+
#[doc = concat!("let min_plus = ", stringify!($Ty), "::new(",
673+
stringify!($Int), "::MIN + 1)?;")]
672674
#[doc = concat!("let max = ", stringify!($Ty), "::new(",
673675
stringify!($Int), "::MAX)?;")]
674676
///
675677
/// assert_eq!(pos, pos.wrapping_abs());
676678
/// assert_eq!(pos, neg.wrapping_abs());
677679
/// assert_eq!(min, min.wrapping_abs());
680+
/// assert_eq!(max, min_plus.wrapping_abs());
678681
/// # // FIXME: add once Neg is implemented?
679682
/// # // assert_eq!(max, (-max).wrapping_abs());
680683
/// # Some(())

0 commit comments

Comments
 (0)