Clean up clippy.

This commit is contained in:
Stephen Chung
2022-07-27 16:04:24 +08:00
parent 21f822020f
commit 39dee556c4
36 changed files with 271 additions and 369 deletions

View File

@@ -128,10 +128,9 @@ impl FuncInfo {
let typ = typ.trim();
if typ.starts_with("rhai::") {
return Self::format_type(&typ[6..], is_return_type);
} else if typ.starts_with("&mut ") {
let x = &typ[5..];
if let Some(x) = typ.strip_prefix("rhai::") {
return Self::format_type(x, is_return_type);
} else if let Some(x) = typ.strip_prefix("&mut ") {
let r = Self::format_type(x, false);
return if r == x {
typ.into()
@@ -1896,7 +1895,6 @@ impl Module {
#[cfg(not(feature = "no_function"))]
#[cfg(feature = "internals")]
#[inline(always)]
#[must_use]
pub fn iter_script_fn_info(
&self,
) -> impl Iterator<

View File

@@ -20,6 +20,7 @@ use std::{ops::AddAssign, slice::Iter, vec::IntoIter};
/// let mut engine = Engine::new();
/// engine.set_module_resolver(collection);
/// ```
#[derive(Default)]
pub struct ModuleResolversCollection(Vec<Box<dyn ModuleResolver>>);
impl ModuleResolversCollection {
@@ -41,7 +42,7 @@ impl ModuleResolversCollection {
/// ```
#[inline(always)]
#[must_use]
pub fn new() -> Self {
pub const fn new() -> Self {
Self(Vec::new())
}
/// Append a [module resolver][ModuleResolver] to the end.

View File

@@ -374,7 +374,7 @@ impl ModuleResolver for FileModuleResolver {
pos: Position,
) -> Option<RhaiResultOf<crate::AST>> {
// Construct the script file path
let file_path = self.get_file_path(path, source_path.map(|s| Path::new(s)));
let file_path = self.get_file_path(path, source_path.map(Path::new));
// Load the script file and compile it
Some(