Refine inlining.

This commit is contained in:
Stephen Chung
2022-09-28 12:06:22 +08:00
parent 82b64e9c7a
commit 6c777e68d3
31 changed files with 68 additions and 49 deletions

View File

@@ -36,6 +36,7 @@ pub struct AST {
impl Default for AST {
#[inline(always)]
#[must_use]
fn default() -> Self {
Self::empty()
}

View File

@@ -75,8 +75,8 @@ impl CustomExpr {
/// Is this custom syntax self-terminated (i.e. no need for a semicolon terminator)?
///
/// A self-terminated custom syntax always ends in `$block$`, `}` or `;`
#[must_use]
#[inline(always)]
#[must_use]
pub const fn is_self_terminated(&self) -> bool {
self.self_terminated
}
@@ -281,7 +281,6 @@ impl<F: Float> Deref for FloatWrapper<F> {
type Target = F;
#[inline(always)]
#[must_use]
fn deref(&self) -> &Self::Target {
&self.0
}
@@ -290,7 +289,6 @@ impl<F: Float> Deref for FloatWrapper<F> {
#[cfg(not(feature = "no_float"))]
impl<F: Float> DerefMut for FloatWrapper<F> {
#[inline(always)]
#[must_use]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
@@ -447,6 +445,7 @@ pub enum Expr {
impl Default for Expr {
#[inline(always)]
#[must_use]
fn default() -> Self {
Self::Unit(Position::NONE)
}

View File

@@ -40,7 +40,6 @@ impl Deref for Ident {
type Target = ImmutableString;
#[inline(always)]
#[must_use]
fn deref(&self) -> &Self::Target {
&self.name
}
@@ -48,7 +47,6 @@ impl Deref for Ident {
impl DerefMut for Ident {
#[inline(always)]
#[must_use]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.name
}

View File

@@ -72,7 +72,6 @@ impl Deref for Namespace {
type Target = StaticVec<Ident>;
#[inline(always)]
#[must_use]
fn deref(&self) -> &Self::Target {
&self.path
}
@@ -80,7 +79,6 @@ impl Deref for Namespace {
impl DerefMut for Namespace {
#[inline(always)]
#[must_use]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.path
}

View File

@@ -209,6 +209,7 @@ impl IntoIterator for RangeCase {
type IntoIter = Box<dyn Iterator<Item = Self::Item>>;
#[inline(always)]
#[must_use]
fn into_iter(self) -> Self::IntoIter {
match self {
Self::ExclusiveInt(r, ..) => Box::new(r),
@@ -426,7 +427,6 @@ impl Deref for StmtBlock {
type Target = StmtBlockContainer;
#[inline(always)]
#[must_use]
fn deref(&self) -> &Self::Target {
&self.block
}
@@ -434,7 +434,6 @@ impl Deref for StmtBlock {
impl DerefMut for StmtBlock {
#[inline(always)]
#[must_use]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.block
}
@@ -607,6 +606,7 @@ pub enum Stmt {
impl Default for Stmt {
#[inline(always)]
#[must_use]
fn default() -> Self {
Self::Noop(Position::NONE)
}