Skip to content

Commit

Permalink
Modify NonZero documentation to reference the underlying integer type
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
frectonz committed Nov 3, 2024
1 parent db034ce commit 9d66cfa
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion library/core/src/num/nonzero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,15 @@ macro_rules! nonzero_integer {
reversed = $reversed:literal,
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.
#[doc = concat!("For example, `Option<", stringify!($Ty), ">` is the same size as `", stringify!($Int), "`:")]
Expand Down

0 comments on commit 9d66cfa

Please sign in to comment.