Refactor.

This commit is contained in:
Stephen Chung
2022-09-25 12:24:03 +08:00
parent def1a683ef
commit b56a9c22f3
20 changed files with 55 additions and 16 deletions

View File

@@ -147,6 +147,7 @@ impl Expression<'_> {
impl AsRef<Expr> for Expression<'_> {
#[inline(always)]
#[must_use]
fn as_ref(&self) -> &Expr {
self.0
}
@@ -156,6 +157,7 @@ impl Deref for Expression<'_> {
type Target = Expr;
#[inline(always)]
#[must_use]
fn deref(&self) -> &Self::Target {
self.0
}

View File

@@ -75,6 +75,7 @@ impl Engine {
/// Not available under `no_module`.
#[cfg(not(feature = "no_module"))]
#[inline(always)]
#[must_use]
pub fn module_resolver(&self) -> &dyn crate::ModuleResolver {
&*self.module_resolver
}

View File

@@ -16,12 +16,14 @@ impl Engine {
/// Get the global namespace module (which is the fist module in `global_modules`).
#[inline(always)]
#[allow(dead_code)]
#[must_use]
pub(crate) fn global_namespace(&self) -> &Module {
self.global_modules.first().unwrap()
}
/// Get a mutable reference to the global namespace module
/// (which is the first module in `global_modules`).
#[inline(always)]
#[must_use]
pub(crate) fn global_namespace_mut(&mut self) -> &mut Module {
let module = self.global_modules.first_mut().unwrap();
Shared::get_mut(module).expect("not shared")