Skip to content

Commit d956fa1

Browse files
committed
style: Update doctests for highest_one and lowest_one
Use binary literals instead of hex literals.
1 parent c0ff72f commit d956fa1

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

library/core/src/num/int_macros.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,10 @@ macro_rules! int_impl {
217217
/// ```
218218
/// #![feature(int_lowest_highest_one)]
219219
///
220-
#[doc = concat!("assert_eq!(0x0_", stringify!($SelfT), ".highest_one(), None);")]
221-
#[doc = concat!("assert_eq!(0x1_", stringify!($SelfT), ".highest_one(), Some(0));")]
222-
#[doc = concat!("assert_eq!(0x10_", stringify!($SelfT), ".highest_one(), Some(4));")]
223-
#[doc = concat!("assert_eq!(0x1f_", stringify!($SelfT), ".highest_one(), Some(4));")]
220+
#[doc = concat!("assert_eq!(0b0_", stringify!($SelfT), ".highest_one(), None);")]
221+
#[doc = concat!("assert_eq!(0b1_", stringify!($SelfT), ".highest_one(), Some(0));")]
222+
#[doc = concat!("assert_eq!(0b1_0000_", stringify!($SelfT), ".highest_one(), Some(4));")]
223+
#[doc = concat!("assert_eq!(0b1_1111_", stringify!($SelfT), ".highest_one(), Some(4));")]
224224
/// ```
225225
#[unstable(feature = "int_lowest_highest_one", issue = "145203")]
226226
#[must_use = "this returns the result of the operation, \
@@ -238,10 +238,10 @@ macro_rules! int_impl {
238238
/// ```
239239
/// #![feature(int_lowest_highest_one)]
240240
///
241-
#[doc = concat!("assert_eq!(0x0_", stringify!($SelfT), ".lowest_one(), None);")]
242-
#[doc = concat!("assert_eq!(0x1_", stringify!($SelfT), ".lowest_one(), Some(0));")]
243-
#[doc = concat!("assert_eq!(0x10_", stringify!($SelfT), ".lowest_one(), Some(4));")]
244-
#[doc = concat!("assert_eq!(0x1f_", stringify!($SelfT), ".lowest_one(), Some(0));")]
241+
#[doc = concat!("assert_eq!(0b0_", stringify!($SelfT), ".lowest_one(), None);")]
242+
#[doc = concat!("assert_eq!(0b1_", stringify!($SelfT), ".lowest_one(), Some(0));")]
243+
#[doc = concat!("assert_eq!(0b1_0000_", stringify!($SelfT), ".lowest_one(), Some(4));")]
244+
#[doc = concat!("assert_eq!(0b1_1111_", stringify!($SelfT), ".lowest_one(), Some(0));")]
245245
/// ```
246246
#[unstable(feature = "int_lowest_highest_one", issue = "145203")]
247247
#[must_use = "this returns the result of the operation, \

library/core/src/num/nonzero.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -708,9 +708,9 @@ macro_rules! nonzero_integer {
708708
/// # use core::num::NonZero;
709709
/// # fn main() { test().unwrap(); }
710710
/// # fn test() -> Option<()> {
711-
#[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0x1)?.highest_one(), 0);")]
712-
#[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0x10)?.highest_one(), 4);")]
713-
#[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0x1f)?.highest_one(), 4);")]
711+
#[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0b1)?.highest_one(), 0);")]
712+
#[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0b1_0000)?.highest_one(), 4);")]
713+
#[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0b1_1111)?.highest_one(), 4);")]
714714
/// # Some(())
715715
/// # }
716716
/// ```
@@ -732,9 +732,9 @@ macro_rules! nonzero_integer {
732732
/// # use core::num::NonZero;
733733
/// # fn main() { test().unwrap(); }
734734
/// # fn test() -> Option<()> {
735-
#[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0x1)?.lowest_one(), 0);")]
736-
#[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0x10)?.lowest_one(), 4);")]
737-
#[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0x1f)?.lowest_one(), 0);")]
735+
#[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0b1)?.lowest_one(), 0);")]
736+
#[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0b1_0000)?.lowest_one(), 4);")]
737+
#[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0b1_1111)?.lowest_one(), 0);")]
738738
/// # Some(())
739739
/// # }
740740
/// ```

library/core/src/num/uint_macros.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,10 @@ macro_rules! uint_impl {
272272
/// ```
273273
/// #![feature(int_lowest_highest_one)]
274274
///
275-
#[doc = concat!("assert_eq!(0x0_", stringify!($SelfT), ".highest_one(), None);")]
276-
#[doc = concat!("assert_eq!(0x1_", stringify!($SelfT), ".highest_one(), Some(0));")]
277-
#[doc = concat!("assert_eq!(0x10_", stringify!($SelfT), ".highest_one(), Some(4));")]
278-
#[doc = concat!("assert_eq!(0x1f_", stringify!($SelfT), ".highest_one(), Some(4));")]
275+
#[doc = concat!("assert_eq!(0b0_", stringify!($SelfT), ".highest_one(), None);")]
276+
#[doc = concat!("assert_eq!(0b1_", stringify!($SelfT), ".highest_one(), Some(0));")]
277+
#[doc = concat!("assert_eq!(0b1_0000_", stringify!($SelfT), ".highest_one(), Some(4));")]
278+
#[doc = concat!("assert_eq!(0b1_1111_", stringify!($SelfT), ".highest_one(), Some(4));")]
279279
/// ```
280280
#[unstable(feature = "int_lowest_highest_one", issue = "145203")]
281281
#[must_use = "this returns the result of the operation, \
@@ -296,10 +296,10 @@ macro_rules! uint_impl {
296296
/// ```
297297
/// #![feature(int_lowest_highest_one)]
298298
///
299-
#[doc = concat!("assert_eq!(0x0_", stringify!($SelfT), ".lowest_one(), None);")]
300-
#[doc = concat!("assert_eq!(0x1_", stringify!($SelfT), ".lowest_one(), Some(0));")]
301-
#[doc = concat!("assert_eq!(0x10_", stringify!($SelfT), ".lowest_one(), Some(4));")]
302-
#[doc = concat!("assert_eq!(0x1f_", stringify!($SelfT), ".lowest_one(), Some(0));")]
299+
#[doc = concat!("assert_eq!(0b0_", stringify!($SelfT), ".lowest_one(), None);")]
300+
#[doc = concat!("assert_eq!(0b1_", stringify!($SelfT), ".lowest_one(), Some(0));")]
301+
#[doc = concat!("assert_eq!(0b1_0000_", stringify!($SelfT), ".lowest_one(), Some(4));")]
302+
#[doc = concat!("assert_eq!(0b1_1111_", stringify!($SelfT), ".lowest_one(), Some(0));")]
303303
/// ```
304304
#[unstable(feature = "int_lowest_highest_one", issue = "145203")]
305305
#[must_use = "this returns the result of the operation, \

0 commit comments

Comments
 (0)