Rollup merge of #78491 - petertodd:2020-inline-from-nonzero, r=sfackler

Inline NonZeroN::from(n)

Currently this results in the generated assembly having a function call for this trivial conversion.
This commit is contained in:
Yuki Okushi 2020-10-29 12:08:59 +09:00 committed by GitHub
commit c7792230c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -92,6 +92,7 @@ assert_eq!(size_of::<Option<core::num::", stringify!($Ty), ">>(), size_of::<", s
doc_comment! {
concat!(
"Converts a `", stringify!($Ty), "` into an `", stringify!($Int), "`"),
#[inline]
fn from(nonzero: $Ty) -> Self {
nonzero.0
}