Minor cleanup.

This commit is contained in:
Stephen Chung
2022-05-02 12:14:53 +08:00
parent c69f98c2c4
commit 4f74d2f96a
3 changed files with 9 additions and 17 deletions

View File

@@ -202,15 +202,9 @@ fn test_var_def_filter() -> Result<(), Box<EvalAltResult>> {
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!(