From 4ee6657b9dec9946d68489037a55402c5bc4eaad Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Fri, 28 Jan 2022 22:37:59 +0800 Subject: [PATCH] Fix no_function build. --- src/bin/rhai-repl.rs | 1 + src/eval/expr.rs | 4 +++- src/eval/global_state.rs | 3 --- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bin/rhai-repl.rs b/src/bin/rhai-repl.rs index 0ed79130..6af84a55 100644 --- a/src/bin/rhai-repl.rs +++ b/src/bin/rhai-repl.rs @@ -283,6 +283,7 @@ fn main() { println!("{}", f) } + #[cfg(not(feature = "no_function"))] for f in main_ast.iter_functions() { println!("{}", f) } diff --git a/src/eval/expr.rs b/src/eval/expr.rs index c3f1a5f4..d81a7755 100644 --- a/src/eval/expr.rs +++ b/src/eval/expr.rs @@ -93,7 +93,9 @@ impl Engine { #[cfg(not(feature = "no_function"))] if namespace.len() == 1 && namespace[0].name == crate::engine::KEYWORD_GLOBAL { if let Some(ref constants) = global.constants { - if let Some(value) = crate::func::locked_write(constants).get_mut(var_name) { + if let Some(value) = + crate::func::locked_write(constants).get_mut(var_name) + { let mut target: Target = value.clone().into(); // Module variables are constant target.set_access_mode(AccessMode::ReadOnly); diff --git a/src/eval/global_state.rs b/src/eval/global_state.rs index ab32def5..94b730c9 100644 --- a/src/eval/global_state.rs +++ b/src/eval/global_state.rs @@ -22,9 +22,6 @@ use std::{ #[derive(Clone)] pub struct GlobalRuntimeState<'a> { /// Stack of module names. - // - // We cannot use Cow here because `eval` may load a [module][Module] and - // the module name will live beyond the AST of the eval script text. keys: StaticVec, /// Stack of imported [modules][Module]. modules: StaticVec>,