From d956fa10ce7cf10eeb5faa523f0f740dcc1f3766 Mon Sep 17 00:00:00 2001 From: Shun Sakai Date: Wed, 5 Nov 2025 19:19:36 +0900 Subject: [PATCH] style: Update doctests for `highest_one` and `lowest_one` Use binary literals instead of hex literals. --- library/core/src/num/int_macros.rs | 16 ++++++++-------- library/core/src/num/nonzero.rs | 12 ++++++------ library/core/src/num/uint_macros.rs | 16 ++++++++-------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index 16f85c71403ab..7d395eb780346 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -217,10 +217,10 @@ macro_rules! int_impl { /// ``` /// #![feature(int_lowest_highest_one)] /// - #[doc = concat!("assert_eq!(0x0_", stringify!($SelfT), ".highest_one(), None);")] - #[doc = concat!("assert_eq!(0x1_", stringify!($SelfT), ".highest_one(), Some(0));")] - #[doc = concat!("assert_eq!(0x10_", stringify!($SelfT), ".highest_one(), Some(4));")] - #[doc = concat!("assert_eq!(0x1f_", stringify!($SelfT), ".highest_one(), Some(4));")] + #[doc = concat!("assert_eq!(0b0_", stringify!($SelfT), ".highest_one(), None);")] + #[doc = concat!("assert_eq!(0b1_", stringify!($SelfT), ".highest_one(), Some(0));")] + #[doc = concat!("assert_eq!(0b1_0000_", stringify!($SelfT), ".highest_one(), Some(4));")] + #[doc = concat!("assert_eq!(0b1_1111_", stringify!($SelfT), ".highest_one(), Some(4));")] /// ``` #[unstable(feature = "int_lowest_highest_one", issue = "145203")] #[must_use = "this returns the result of the operation, \ @@ -238,10 +238,10 @@ macro_rules! int_impl { /// ``` /// #![feature(int_lowest_highest_one)] /// - #[doc = concat!("assert_eq!(0x0_", stringify!($SelfT), ".lowest_one(), None);")] - #[doc = concat!("assert_eq!(0x1_", stringify!($SelfT), ".lowest_one(), Some(0));")] - #[doc = concat!("assert_eq!(0x10_", stringify!($SelfT), ".lowest_one(), Some(4));")] - #[doc = concat!("assert_eq!(0x1f_", stringify!($SelfT), ".lowest_one(), Some(0));")] + #[doc = concat!("assert_eq!(0b0_", stringify!($SelfT), ".lowest_one(), None);")] + #[doc = concat!("assert_eq!(0b1_", stringify!($SelfT), ".lowest_one(), Some(0));")] + #[doc = concat!("assert_eq!(0b1_0000_", stringify!($SelfT), ".lowest_one(), Some(4));")] + #[doc = concat!("assert_eq!(0b1_1111_", stringify!($SelfT), ".lowest_one(), Some(0));")] /// ``` #[unstable(feature = "int_lowest_highest_one", issue = "145203")] #[must_use = "this returns the result of the operation, \ diff --git a/library/core/src/num/nonzero.rs b/library/core/src/num/nonzero.rs index efb0665b7f461..92bca0eebfd93 100644 --- a/library/core/src/num/nonzero.rs +++ b/library/core/src/num/nonzero.rs @@ -708,9 +708,9 @@ macro_rules! nonzero_integer { /// # use core::num::NonZero; /// # fn main() { test().unwrap(); } /// # fn test() -> Option<()> { - #[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0x1)?.highest_one(), 0);")] - #[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0x10)?.highest_one(), 4);")] - #[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0x1f)?.highest_one(), 4);")] + #[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0b1)?.highest_one(), 0);")] + #[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0b1_0000)?.highest_one(), 4);")] + #[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0b1_1111)?.highest_one(), 4);")] /// # Some(()) /// # } /// ``` @@ -732,9 +732,9 @@ macro_rules! nonzero_integer { /// # use core::num::NonZero; /// # fn main() { test().unwrap(); } /// # fn test() -> Option<()> { - #[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0x1)?.lowest_one(), 0);")] - #[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0x10)?.lowest_one(), 4);")] - #[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0x1f)?.lowest_one(), 0);")] + #[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0b1)?.lowest_one(), 0);")] + #[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0b1_0000)?.lowest_one(), 4);")] + #[doc = concat!("assert_eq!(NonZero::<", stringify!($Int), ">::new(0b1_1111)?.lowest_one(), 0);")] /// # Some(()) /// # } /// ``` diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs index 1efc551d670ab..2996e7b00da4e 100644 --- a/library/core/src/num/uint_macros.rs +++ b/library/core/src/num/uint_macros.rs @@ -272,10 +272,10 @@ macro_rules! uint_impl { /// ``` /// #![feature(int_lowest_highest_one)] /// - #[doc = concat!("assert_eq!(0x0_", stringify!($SelfT), ".highest_one(), None);")] - #[doc = concat!("assert_eq!(0x1_", stringify!($SelfT), ".highest_one(), Some(0));")] - #[doc = concat!("assert_eq!(0x10_", stringify!($SelfT), ".highest_one(), Some(4));")] - #[doc = concat!("assert_eq!(0x1f_", stringify!($SelfT), ".highest_one(), Some(4));")] + #[doc = concat!("assert_eq!(0b0_", stringify!($SelfT), ".highest_one(), None);")] + #[doc = concat!("assert_eq!(0b1_", stringify!($SelfT), ".highest_one(), Some(0));")] + #[doc = concat!("assert_eq!(0b1_0000_", stringify!($SelfT), ".highest_one(), Some(4));")] + #[doc = concat!("assert_eq!(0b1_1111_", stringify!($SelfT), ".highest_one(), Some(4));")] /// ``` #[unstable(feature = "int_lowest_highest_one", issue = "145203")] #[must_use = "this returns the result of the operation, \ @@ -296,10 +296,10 @@ macro_rules! uint_impl { /// ``` /// #![feature(int_lowest_highest_one)] /// - #[doc = concat!("assert_eq!(0x0_", stringify!($SelfT), ".lowest_one(), None);")] - #[doc = concat!("assert_eq!(0x1_", stringify!($SelfT), ".lowest_one(), Some(0));")] - #[doc = concat!("assert_eq!(0x10_", stringify!($SelfT), ".lowest_one(), Some(4));")] - #[doc = concat!("assert_eq!(0x1f_", stringify!($SelfT), ".lowest_one(), Some(0));")] + #[doc = concat!("assert_eq!(0b0_", stringify!($SelfT), ".lowest_one(), None);")] + #[doc = concat!("assert_eq!(0b1_", stringify!($SelfT), ".lowest_one(), Some(0));")] + #[doc = concat!("assert_eq!(0b1_0000_", stringify!($SelfT), ".lowest_one(), Some(4));")] + #[doc = concat!("assert_eq!(0b1_1111_", stringify!($SelfT), ".lowest_one(), Some(0));")] /// ``` #[unstable(feature = "int_lowest_highest_one", issue = "145203")] #[must_use = "this returns the result of the operation, \