Satisfy clippy.

This commit is contained in:
Stephen Chung
2022-12-22 17:34:58 +08:00
parent bbd94dbffb
commit 80ccd75514
40 changed files with 346 additions and 196 deletions

View File

@@ -273,7 +273,7 @@ impl Engine {
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, this_ptr.as_deref_mut(), node)?;
self.run_debugger(global, caches, scope, this_ptr, node)?;
}
#[cfg(not(feature = "no_module"))]

View File

@@ -107,7 +107,7 @@ impl Engine {
#[inline]
pub fn compile_file_with_scope(&self, scope: &Scope, path: PathBuf) -> RhaiResultOf<AST> {
Self::read_file(&path).and_then(|contents| {
let mut ast = self.compile_with_scope(scope, &contents)?;
let mut ast = self.compile_with_scope(scope, contents)?;
ast.set_source(path.to_string_lossy().as_ref());
Ok(ast)
})

View File

@@ -162,7 +162,7 @@ pub fn format_map_as_json(map: &Map) -> String {
result.push(',');
}
write!(result, "{:?}", key).unwrap();
write!(result, "{key:?}").unwrap();
result.push(':');
if let Some(val) = value.read_lock::<Map>() {
@@ -170,7 +170,7 @@ pub fn format_map_as_json(map: &Map) -> String {
} else if value.is_unit() {
result.push_str("null");
} else {
write!(result, "{:?}", value).unwrap();
write!(result, "{value:?}").unwrap();
}
}

View File

@@ -207,13 +207,11 @@ impl Engine {
/// Get the default value of the custom state for each evaluation run.
#[inline(always)]
#[must_use]
pub const fn default_tag(&self) -> &Dynamic {
&self.def_tag
}
/// Get a mutable reference to the default value of the custom state for each evaluation run.
#[inline(always)]
#[must_use]
pub fn default_tag_mut(&mut self) -> &mut Dynamic {
&mut self.def_tag
}