diff options
| author | Markus Reiter <me@reitermark.us> | 2024-01-29 23:59:09 +0100 |
|---|---|---|
| committer | Markus Reiter <me@reitermark.us> | 2024-02-15 08:09:42 +0100 |
| commit | 746a58d4359786e4aebb372a30829706fa5a968f (patch) | |
| tree | d8e13fb3fc93deb5aa964c863bad51f67937c104 /library/core/src/num/nonzero.rs | |
| parent | ee9c7c940c07d8b67c9a6b2ec930db70dcd23a46 (diff) | |
| download | rust-746a58d4359786e4aebb372a30829706fa5a968f.tar.gz rust-746a58d4359786e4aebb372a30829706fa5a968f.zip | |
Use generic `NonZero` internally.
Diffstat (limited to 'library/core/src/num/nonzero.rs')
| -rw-r--r-- | library/core/src/num/nonzero.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/library/core/src/num/nonzero.rs b/library/core/src/num/nonzero.rs index 288ad8e8d87..ddaffadf4bf 100644 --- a/library/core/src/num/nonzero.rs +++ b/library/core/src/num/nonzero.rs @@ -312,10 +312,10 @@ macro_rules! nonzero_integer { /// #![feature(non_zero_count_ones)] /// # fn main() { test().unwrap(); } /// # fn test() -> Option<()> { - #[doc = concat!("# use std::num::{self, ", stringify!($Ty), "};")] - /// - /// let one = num::NonZeroU32::new(1)?; - /// let three = num::NonZeroU32::new(3)?; + /// # use std::num::*; + /// # + /// let one = NonZeroU32::new(1)?; + /// let three = NonZeroU32::new(3)?; #[doc = concat!("let a = ", stringify!($Ty), "::new(0b100_0000)?;")] #[doc = concat!("let b = ", stringify!($Ty), "::new(0b100_0011)?;")] /// @@ -336,7 +336,7 @@ macro_rules! nonzero_integer { // SAFETY: // `self` is non-zero, which means it has at least one bit set, which means // that the result of `count_ones` is non-zero. - unsafe { NonZeroU32::new_unchecked(self.get().count_ones()) } + unsafe { NonZero::<u32>::new_unchecked(self.get().count_ones()) } } nonzero_integer_signedness_dependent_methods! { |
