diff --git a/examples/no_std.rs b/examples/no_std.rs index 9f51f586..32cf14a2 100644 --- a/examples/no_std.rs +++ b/examples/no_std.rs @@ -7,7 +7,11 @@ fn main() -> Result<(), EvalAltResult> { let result = engine.eval::("40 + 2")?; - println!("Answer: {}", 42); + #[cfg(not(feature = "no_std"))] + println!("Answer: {}", result); + + #[cfg(feature = "no_std")] + assert_eq!(result, 42); Ok(()) } diff --git a/src/api.rs b/src/api.rs index 208f311c..ef1b0091 100644 --- a/src/api.rs +++ b/src/api.rs @@ -177,7 +177,7 @@ impl<'e> Engine<'e> { name: &str, callback: impl Fn(&mut T) -> U + 'static, ) { - let get_fn_name = format!("{}{}", FUNC_GETTER, name); + let get_fn_name = FUNC_GETTER.to_string() + name; self.register_fn(&get_fn_name, callback); } @@ -219,7 +219,7 @@ impl<'e> Engine<'e> { name: &str, callback: impl Fn(&mut T, U) -> () + 'static, ) { - let set_fn_name = format!("{}{}", FUNC_SETTER, name); + let set_fn_name = FUNC_SETTER.to_string() + name; self.register_fn(&set_fn_name, callback); }