Merge pull request #688 from Mathieu-Lala/fix/lint

Fix lints warnings and enhance the CI
This commit is contained in:
Stephen Chung
2023-02-10 18:32:14 +08:00
committed by GitHub
41 changed files with 204 additions and 194 deletions

View File

@@ -212,12 +212,12 @@ impl Engine {
}
/// Evaluate an [`AST`] with own scope, returning the result value or an error.
#[inline]
pub(crate) fn eval_ast_with_scope_raw<'a>(
pub(crate) fn eval_ast_with_scope_raw(
&self,
global: &mut GlobalRuntimeState,
caches: &mut Caches,
scope: &mut Scope,
ast: &'a AST,
ast: &AST,
) -> RhaiResult {
let orig_source = mem::replace(&mut global.source, ast.source_raw().cloned());
@@ -245,16 +245,16 @@ impl Engine {
g.source = orig_source;
});
self.eval_global_statements(global, caches, scope, ast.statements())
.and_then(|r| {
#[cfg(feature = "debugging")]
if self.is_debugger_registered() {
global.debugger_mut().status = crate::eval::DebuggerStatus::Terminate;
let node = &crate::ast::Stmt::Noop(Position::NONE);
self.run_debugger(global, caches, scope, None, node)?;
}
Ok(r)
})
let r = self.eval_global_statements(global, caches, scope, ast.statements())?;
#[cfg(feature = "debugging")]
if self.is_debugger_registered() {
global.debugger_mut().status = crate::eval::DebuggerStatus::Terminate;
let node = &crate::ast::Stmt::Noop(Position::NONE);
self.run_debugger(global, caches, scope, None, node)?;
}
Ok(r)
}
}

View File

@@ -97,7 +97,7 @@ impl Engine {
///
/// // Compile a script to an AST and store it for later evaluation.
/// // Notice that a PathBuf is required which can easily be constructed from a string.
/// let ast = engine.compile_file_with_scope(&mut scope, "script.rhai".into())?;
/// let ast = engine.compile_file_with_scope(&scope, "script.rhai".into())?;
///
/// let result = engine.eval_ast::<i64>(&ast)?;
/// # }

View File

@@ -126,16 +126,16 @@ impl Engine {
global.embedded_module_resolver = ast.resolver().cloned();
}
self.eval_global_statements(global, caches, scope, ast.statements())
.and_then(|_| {
#[cfg(feature = "debugging")]
if self.is_debugger_registered() {
global.debugger_mut().status = crate::eval::DebuggerStatus::Terminate;
let node = &crate::ast::Stmt::Noop(crate::Position::NONE);
self.run_debugger(global, caches, scope, None, node)?;
}
Ok(())
})
let _ = self.eval_global_statements(global, caches, scope, ast.statements())?;
#[cfg(feature = "debugging")]
if self.is_debugger_registered() {
global.debugger_mut().status = crate::eval::DebuggerStatus::Terminate;
let node = &crate::ast::Stmt::Noop(crate::Position::NONE);
self.run_debugger(global, caches, scope, None, node)?;
}
Ok(())
}
}