Change some #[inline(always)] to [#inline].

This commit is contained in:
Stephen Chung
2021-07-10 11:06:13 +08:00
parent 4d25fd0192
commit e0673a2f1a
18 changed files with 109 additions and 138 deletions

View File

@@ -112,7 +112,7 @@ impl FuncInfo {
/// # Note
///
/// The first module name is skipped. Hashing starts from the _second_ module in the chain.
#[inline(always)]
#[inline]
fn calc_native_fn_hash<'a>(
modules: impl Iterator<Item = &'a str>,
fn_name: &str,
@@ -324,7 +324,7 @@ impl Module {
/// let module = Module::new();
/// assert!(module.is_empty());
/// ```
#[inline(always)]
#[inline]
#[must_use]
pub fn is_empty(&self) -> bool {
self.functions.is_empty()
@@ -437,7 +437,7 @@ impl Module {
/// module.set_var("answer", 42_i64);
/// assert_eq!(module.get_var_value::<i64>("answer").unwrap(), 42);
/// ```
#[inline(always)]
#[inline]
pub fn set_var(
&mut self,
name: impl Into<Identifier>,
@@ -519,7 +519,7 @@ impl Module {
/// By taking a mutable reference, it is assumed that some sub-modules will be modified.
/// Thus the [`Module`] is automatically set to be non-indexed.
#[cfg(not(feature = "no_module"))]
#[inline(always)]
#[inline]
#[must_use]
pub(crate) fn sub_modules_mut(&mut self) -> &mut BTreeMap<Identifier, Shared<Module>> {
// We must assume that the user has changed the sub-modules
@@ -580,7 +580,7 @@ impl Module {
/// module.set_sub_module("question", sub_module);
/// assert!(module.get_sub_module("question").is_some());
/// ```
#[inline(always)]
#[inline]
pub fn set_sub_module(
&mut self,
name: impl Into<Identifier>,
@@ -624,7 +624,7 @@ impl Module {
/// The _last entry_ in the list should be the _return type_ of the function.
/// In other words, the number of entries should be one larger than the number of parameters.
#[cfg(feature = "metadata")]
#[inline(always)]
#[inline]
pub fn update_fn_metadata(&mut self, hash_fn: u64, arg_names: &[&str]) -> &mut Self {
let param_names = arg_names
.iter()
@@ -641,7 +641,7 @@ impl Module {
/// Update the namespace of a registered function.
///
/// The [`u64`] hash is returned by the [`set_native_fn`][Module::set_native_fn] call.
#[inline(always)]
#[inline]
pub fn update_fn_namespace(&mut self, hash_fn: u64, namespace: FnNamespace) -> &mut Self {
if let Some(f) = self.functions.get_mut(&hash_fn) {
f.namespace = namespace;
@@ -652,7 +652,7 @@ impl Module {
}
/// Remap type ID.
#[inline(always)]
#[inline]
#[must_use]
fn map_type(map: bool, type_id: TypeId) -> TypeId {
if !map {
@@ -1611,7 +1611,7 @@ impl Module {
}
/// Set a type iterator into the [`Module`].
#[inline(always)]
#[inline]
pub fn set_iter(&mut self, type_id: TypeId, func: IteratorFn) -> &mut Self {
if self.indexed {
self.all_type_iterators.insert(type_id, func.clone());
@@ -1678,7 +1678,6 @@ pub struct NamespaceRef {
}
impl fmt::Debug for NamespaceRef {
#[inline(always)]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if let Some(index) = self.index {
write!(f, "{} -> ", index)?;
@@ -1696,7 +1695,6 @@ impl fmt::Debug for NamespaceRef {
}
impl fmt::Display for NamespaceRef {
#[inline(always)]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
for Ident { name, .. } in self.path.iter() {
write!(f, "{}{}", name, Token::DoubleColon.syntax())?;
@@ -1735,7 +1733,10 @@ impl NamespaceRef {
#[inline(always)]
#[must_use]
pub fn new(&self) -> Self {
Default::default()
Self {
index: None,
path: StaticVec::new(),
}
}
/// Get the [`Scope`][crate::Scope] index offset.
#[inline(always)]