Rollup merge of #68651 - LeSeulArtichaut:doc-from-nonzero, r=steveklabnik

Document `From` implementation for NonZero nums

This is more of a nitpick than a real change in documentation. I did this for consistency with other documentation (namely Atomic integers).

Related to #51430

r? @steveklabnik

PS: I actually tested the code this time. My CPU died in the process, but I get to open a (hopefully 🤞) working PR
This commit is contained in:
Dylan DPC 2020-01-30 01:46:46 +01:00 committed by GitHub
commit 1780f2f12f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -91,10 +91,14 @@ assert_eq!(size_of::<Option<core::num::", stringify!($Ty), ">>(), size_of::<", s
#[stable(feature = "from_nonzero", since = "1.31.0")] #[stable(feature = "from_nonzero", since = "1.31.0")]
impl From<$Ty> for $Int { impl From<$Ty> for $Int {
doc_comment! {
concat!(
"Converts a `", stringify!($Ty), "` into an `", stringify!($Int), "`"),
fn from(nonzero: $Ty) -> Self { fn from(nonzero: $Ty) -> Self {
nonzero.0 nonzero.0
} }
} }
}
impl_nonzero_fmt! { impl_nonzero_fmt! {
#[$stability] (Debug, Display, Binary, Octal, LowerHex, UpperHex) for $Ty #[$stability] (Debug, Display, Binary, Octal, LowerHex, UpperHex) for $Ty