Use #[inline(always)] only when relatively certain.

This commit is contained in:
Stephen Chung
2021-10-21 17:26:43 +08:00
parent 313999b0ac
commit 9c16d90de9
21 changed files with 129 additions and 122 deletions

View File

@@ -718,7 +718,7 @@ impl AST {
/// Not available under `no_function`.
#[cfg(not(feature = "no_function"))]
#[cfg(not(feature = "no_module"))]
#[inline(always)]
#[inline]
pub(crate) fn iter_fn_def(&self) -> impl Iterator<Item = &ScriptFnDef> {
self.functions
.iter_script_fn()
@@ -728,7 +728,7 @@ impl AST {
///
/// Not available under `no_function`.
#[cfg(not(feature = "no_function"))]
#[inline(always)]
#[inline]
pub fn iter_functions<'a>(&'a self) -> impl Iterator<Item = ScriptFnMetadata> + 'a {
self.functions
.iter_script_fn()
@@ -944,7 +944,7 @@ impl fmt::Debug for StmtBlock {
}
impl From<StmtBlock> for Stmt {
#[inline(always)]
#[inline]
fn from(block: StmtBlock) -> Self {
let block_pos = block.position();
Self::Block(block.0.into_boxed_slice(), block_pos)
@@ -1852,7 +1852,7 @@ impl<F: Float> From<F> for FloatWrapper<F> {
impl<F: Float + FromStr> FromStr for FloatWrapper<F> {
type Err = <F as FromStr>::Err;
#[inline(always)]
#[inline]
fn from_str(s: &str) -> Result<Self, Self::Err> {
F::from_str(s).map(Into::<Self>::into)
}
@@ -2132,7 +2132,7 @@ impl Expr {
}
}
/// Is the expression a simple variable access?
#[inline(always)]
#[inline]
#[must_use]
pub(crate) const fn is_variable_access(&self, non_qualified: bool) -> bool {
match self {
@@ -2141,7 +2141,7 @@ impl Expr {
}
}
/// Return the variable name if the expression a simple variable access.
#[inline(always)]
#[inline]
#[must_use]
pub(crate) fn get_variable_name(&self, non_qualified: bool) -> Option<&str> {
match self {