Skip to content

Commit

Permalink
Add code example for wrapping_neg method for signed integers
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Nov 22, 2024
1 parent 3c558bf commit 30aa6db
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions core/src/num/int_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2101,6 +2101,7 @@ macro_rules! int_impl {
///
/// ```
#[doc = concat!("assert_eq!(100", stringify!($SelfT), ".wrapping_neg(), -100);")]
#[doc = concat!("assert_eq!((-100", stringify!($SelfT), ").wrapping_neg(), 100);")]
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.wrapping_neg(), ", stringify!($SelfT), "::MIN);")]
/// ```
#[stable(feature = "num_wrapping", since = "1.2.0")]
Expand Down

0 comments on commit 30aa6db

Please sign in to comment.