Fix clippy.

This commit is contained in:
Stephen Chung 2021-01-09 17:13:34 +08:00
parent e5b345bca4
commit 0b6657d1b1

View File

@ -240,14 +240,12 @@ impl ModuleResolver for FileModuleResolver {
file_path.set_extension(&self.extension); // Force extension
// Load the script file and compile it
let mut ast = engine
.compile_file(file_path.clone())
.map_err(|err| match *err {
EvalAltResult::ErrorSystem(_, err) if err.is::<IoError>() => {
Box::new(EvalAltResult::ErrorModuleNotFound(path.to_string(), pos))
}
_ => Box::new(EvalAltResult::ErrorInModule(path.to_string(), err, pos)),
})?;
let mut ast = engine.compile_file(file_path).map_err(|err| match *err {
EvalAltResult::ErrorSystem(_, err) if err.is::<IoError>() => {
Box::new(EvalAltResult::ErrorModuleNotFound(path.to_string(), pos))
}
_ => Box::new(EvalAltResult::ErrorInModule(path.to_string(), err, pos)),
})?;
ast.set_source(path);