Update api.rs

This commit is contained in:
Stephen Chung 2020-03-13 18:31:17 +08:00 committed by GitHub
parent c7a6777b70
commit f91d068c0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -112,7 +112,7 @@ impl<'e> Engine<'e> {
let mut contents = String::new();
f.read_to_string(&mut contents)
.map_err(|err| EvalAltResult::ErrorReadingScriptFile(filename.into(), err))
.map_err(|err| EvalAltResult::ErrorReadingScriptFile(path.clone(), err))
.map(|_| contents)
}
@ -210,7 +210,7 @@ impl<'e> Engine<'e> {
path: PathBuf,
retain_functions: bool,
) -> Result<(), EvalAltResult> {
Self::read_file(path).and_then(|_| self.consume(&contents, retain_functions))
Self::read_file(path).and_then(|contents| self.consume(&contents, retain_functions))
}
/// Evaluate a string, but throw away the result and only return error (if any).