Minor refactors.
This commit is contained in:
@@ -35,9 +35,10 @@ impl<'x, 'px, 'm, 'pm, 'pt> EvalContext<'_, 'x, 'px, 'm, 'pm, '_, '_, '_, '_, 'p
|
||||
#[inline(always)]
|
||||
#[must_use]
|
||||
pub fn source(&self) -> Option<&str> {
|
||||
match self.global.source.as_str() {
|
||||
"" => None,
|
||||
s => Some(s),
|
||||
if self.global.source.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(self.global.source.as_str())
|
||||
}
|
||||
}
|
||||
/// The current [`Scope`].
|
||||
|
@@ -28,7 +28,7 @@ pub struct EvalState<'a> {
|
||||
/// Stack of function resolution caches.
|
||||
fn_resolution_caches: StaticVec<FnResolutionCache>,
|
||||
/// Take care of the lifetime parameter
|
||||
dummy: PhantomData<Option<&'a ()>>,
|
||||
dummy: PhantomData<&'a ()>,
|
||||
}
|
||||
|
||||
impl EvalState<'_> {
|
||||
|
@@ -244,9 +244,10 @@ impl GlobalRuntimeState<'_> {
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn source(&self) -> Option<&str> {
|
||||
match self.source.as_str() {
|
||||
"" => None,
|
||||
s => Some(s),
|
||||
if self.source.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(self.source.as_str())
|
||||
}
|
||||
}
|
||||
/// Get the pre-calculated index getter hash.
|
||||
|
@@ -952,9 +952,10 @@ impl Engine {
|
||||
result => Some(result),
|
||||
})
|
||||
.or_else(|| {
|
||||
self.module_resolver
|
||||
.as_ref()
|
||||
.map(|r| r.resolve_raw(self, global, &path, path_pos))
|
||||
Some(
|
||||
self.module_resolver
|
||||
.resolve_raw(self, global, &path, path_pos),
|
||||
)
|
||||
})
|
||||
.unwrap_or_else(|| {
|
||||
Err(ERR::ErrorModuleNotFound(path.to_string(), path_pos).into())
|
||||
|
Reference in New Issue
Block a user