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,8 +91,12 @@ 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 {
fn from(nonzero: $Ty) -> Self { doc_comment! {
nonzero.0 concat!(
"Converts a `", stringify!($Ty), "` into an `", stringify!($Int), "`"),
fn from(nonzero: $Ty) -> Self {
nonzero.0
}
} }
} }