Modify NonZero documentation to reference the underlying integer type

This change updates the documentation for `NonZero` integer types to
explicitly reference the underlying integer type each `NonZero` variant
wraps, instead of  using a general "integer" term.
This commit is contained in:
frectonz 2024-11-03 18:19:44 +03:00
parent db034cee00
commit 9d66cfaa08
No known key found for this signature in database
GPG Key ID: 9CFA458945B7094F

View File

@ -458,7 +458,15 @@ macro_rules! nonzero_integer {
reversed = $reversed:literal, reversed = $reversed:literal,
leading_zeros_test = $leading_zeros_test:expr, leading_zeros_test = $leading_zeros_test:expr,
) => { ) => {
/// An integer that is known not to equal zero. #[doc = sign_dependent_expr!{
$signedness ?
if signed {
concat!("An [`", stringify!($Int), "`] that is known not to equal zero.")
}
if unsigned {
concat!("A [`", stringify!($Int), "`] that is known not to equal zero.")
}
}]
/// ///
/// This enables some memory layout optimization. /// This enables some memory layout optimization.
#[doc = concat!("For example, `Option<", stringify!($Ty), ">` is the same size as `", stringify!($Int), "`:")] #[doc = concat!("For example, `Option<", stringify!($Ty), ">` is the same size as `", stringify!($Int), "`:")]