diff --git a/src/api/custom_syntax.rs b/src/api/custom_syntax.rs index 978ba920..b7c1f48b 100644 --- a/src/api/custom_syntax.rs +++ b/src/api/custom_syntax.rs @@ -331,7 +331,7 @@ impl Engine { /// /// The implementation function has the following signature: /// - /// > `Fn(symbols: &[ImmutableString], look_ahead: &str) -> Result, ParseError>` + /// `Fn(symbols: &[ImmutableString], look_ahead: &str) -> Result, ParseError>` /// /// where: /// * `symbols`: a slice of symbols that have been parsed so far, possibly containing `$expr$` and/or `$block$`; diff --git a/src/api/events.rs b/src/api/events.rs index 7ac2e2c5..ec7b5022 100644 --- a/src/api/events.rs +++ b/src/api/events.rs @@ -27,7 +27,7 @@ impl Engine { /// /// # Callback Function Signature /// - /// > `Fn(name: &str, index: usize, context: EvalContext) -> Result, Box>` + /// `Fn(name: &str, index: usize, context: EvalContext) -> Result, Box>` /// /// where: /// * `name`: name of the variable. @@ -87,7 +87,7 @@ impl Engine { /// /// # Callback Function Signature /// - /// > `Fn(is_runtime: bool, info: VarInfo, context: EvalContext) -> Result>` + /// `Fn(is_runtime: bool, info: VarInfo, context: EvalContext) -> Result>` /// /// where: /// * `is_runtime`: `true` if the variable definition event happens during runtime, `false` if during compilation. @@ -148,7 +148,7 @@ impl Engine { /// /// # Callback Function Signature /// - /// > `Fn(token: Token, pos: Position, state: &TokenizeState) -> Token` + /// `Fn(token: Token, pos: Position, state: &TokenizeState) -> Token` /// /// where: /// * [`token`][crate::tokenizer::Token]: current token parsed @@ -210,9 +210,7 @@ impl Engine { /// /// # Callback Function Signature /// - /// The callback function signature takes the following form: - /// - /// > `Fn(counter: u64) -> Option` + /// `Fn(counter: u64) -> Option` /// /// ## Return value /// @@ -295,7 +293,7 @@ impl Engine { /// /// The callback function signature passed takes the following form: /// - /// > `Fn(text: &str, source: Option<&str>, pos: Position)` + /// `Fn(text: &str, source: Option<&str>, pos: Position)` /// /// where: /// * `text`: the text to display diff --git a/tests/var_scope.rs b/tests/var_scope.rs index 4e50c3dd..014ec42b 100644 --- a/tests/var_scope.rs +++ b/tests/var_scope.rs @@ -202,15 +202,9 @@ fn test_var_def_filter() -> Result<(), Box> { let ast = engine.compile("let x = 42;")?; engine.run_ast(&ast)?; - engine.on_def_var(|_, info, mut ctx| { - if ctx.tag().is::<()>() { - *ctx.tag_mut() = rhai::Dynamic::ONE; - } - println!("Tag = {}", ctx.tag()); - match (info.name, info.nesting_level) { - ("x", 0 | 1) => Ok(false), - _ => Ok(true), - } + engine.on_def_var(|_, info, _| match (info.name, info.nesting_level) { + ("x", 0 | 1) => Ok(false), + _ => Ok(true), }); assert_eq!(