diff --git a/src/api/call_fn.rs b/src/api/call_fn.rs index 67deb9da..b344c1ae 100644 --- a/src/api/call_fn.rs +++ b/src/api/call_fn.rs @@ -2,7 +2,6 @@ #![cfg(not(feature = "no_function"))] use crate::engine::{EvalState, Imports}; -use crate::func::call::ensure_no_data_race; use crate::types::dynamic::Variant; use crate::{ Dynamic, Engine, EvalAltResult, FuncArgs, Position, RhaiResult, Scope, StaticVec, AST, @@ -176,7 +175,7 @@ impl Engine { // Check for data race. #[cfg(not(feature = "no_closure"))] - ensure_no_data_race(name, &mut args, false)?; + crate::func::call::ensure_no_data_race(name, &mut args, false)?; let result = self.call_script_fn( scope, diff --git a/src/api/compile.rs b/src/api/compile.rs index 8fbba23a..5ed08043 100644 --- a/src/api/compile.rs +++ b/src/api/compile.rs @@ -1,7 +1,7 @@ //! Module that defines the public compilation API of [`Engine`]. use crate::parser::ParseState; -use crate::{Engine, EvalAltResult, Identifier, ParseError, Position, Scope, AST}; +use crate::{Engine, ParseError, Scope, AST}; #[cfg(feature = "no_std")] use std::prelude::v1::*; @@ -91,7 +91,7 @@ impl Engine { &self, scope: &Scope, script: impl AsRef, - ) -> Result> { + ) -> Result> { use crate::{ ast::{ASTNode, Expr, Stmt}, func::native::shared_take_or_clone, @@ -102,7 +102,7 @@ impl Engine { fn collect_imports( ast: &AST, resolver: &StaticModuleResolver, - imports: &mut BTreeSet, + imports: &mut BTreeSet, ) { ast.walk( &mut |path| match path.last().expect("contains current node") { @@ -130,7 +130,7 @@ impl Engine { while let Some(path) = imports.iter().next() { let path = path.clone(); - match module_resolver.resolve_ast(self, None, &path, Position::NONE) { + match module_resolver.resolve_ast(self, None, &path, crate::Position::NONE) { Some(Ok(module_ast)) => { collect_imports(&module_ast, &resolver, &mut imports) } @@ -138,7 +138,8 @@ impl Engine { None => (), } - let module = module_resolver.resolve(self, None, &path, Position::NONE)?; + let module = + module_resolver.resolve(self, None, &path, crate::Position::NONE)?; let module = shared_take_or_clone(module); imports.remove(&path); @@ -361,14 +362,14 @@ impl Engine { &self, json: impl AsRef, has_null: bool, - ) -> Result> { + ) -> Result> { use crate::tokenizer::Token; fn parse_json_inner( engine: &Engine, json: &str, has_null: bool, - ) -> Result> { + ) -> Result> { let mut scope = Scope::new(); let json_text = json.trim_start(); let scripts = if json_text.starts_with(Token::MapStart.literal_syntax()) { @@ -380,7 +381,10 @@ impl Engine { Token::LeftBrace.syntax().into(), "to start a JSON object hash".into(), ) - .into_err(Position::new(1, (json.len() - json_text.len() + 1) as u16)) + .into_err(crate::Position::new( + 1, + (json.len() - json_text.len() + 1) as u16, + )) .into()); }; let (stream, tokenizer_control) = engine.lex_raw( diff --git a/src/func/args.rs b/src/func/args.rs index 53538a2f..e2e21f6a 100644 --- a/src/func/args.rs +++ b/src/func/args.rs @@ -34,6 +34,8 @@ pub trait FuncArgs { /// } /// /// # fn main() -> Result<(), Box> { + /// # #[cfg(not(feature = "no_function"))] + /// # { /// let options = Options { foo: false, bar: "world".to_string(), baz: 42 }; /// /// let engine = Engine::new(); @@ -49,6 +51,7 @@ pub trait FuncArgs { /// let result: String = engine.call_fn(&mut scope, &ast, "hello", options)?; /// /// assert_eq!(result, "world42"); + /// # } /// # Ok(()) /// # } /// ```