Add some more #[inline] annotations for trivial functions (#2817)

Looking at some profiles these or their related functions were all
showing up, so this commit adds `#[inline]` to allow cross-crate
inlining by default.
This commit is contained in:
Alex Crichton
2021-04-08 12:23:54 -05:00
committed by GitHub
parent 5c4c03d278
commit c77ea0c5c7
5 changed files with 23 additions and 0 deletions

View File

@@ -970,6 +970,7 @@ impl InstanceHandle {
/// of the internals, there's no lifetime tracking around its validity.
/// You'll need to ensure that the returned handles all go out of scope at
/// the same time.
#[inline]
pub unsafe fn clone(&self) -> InstanceHandle {
InstanceHandle {
instance: self.instance,

View File

@@ -490,17 +490,20 @@ mod test_vmshared_signature_index {
impl VMSharedSignatureIndex {
/// Create a new `VMSharedSignatureIndex`.
#[inline]
pub fn new(value: u32) -> Self {
Self(value)
}
/// Returns the underlying bits of the index.
#[inline]
pub fn bits(&self) -> u32 {
self.0
}
}
impl Default for VMSharedSignatureIndex {
#[inline]
fn default() -> Self {
Self::new(u32::MAX)
}