diff --git a/src/any.rs b/src/any.rs index 4a330cff..5182da08 100644 --- a/src/any.rs +++ b/src/any.rs @@ -18,7 +18,6 @@ use crate::stdlib::{ boxed::Box, collections::HashMap, fmt, - hash::Hash, string::String, vec::Vec, }; diff --git a/src/engine.rs b/src/engine.rs index 16205a2f..0a5ec70a 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -710,7 +710,7 @@ impl Engine { /// This function restores the first argument that was replaced by `normalize_first_arg_of_method_call`. fn restore_first_arg<'a>(old_this_ptr: Option<&'a mut Dynamic>, args: &mut FnCallArgs<'a>) { if let Some(this_pointer) = old_this_ptr { - mem::replace(args.get_mut(0).unwrap(), this_pointer); + args[0] = this_pointer; } } diff --git a/src/module.rs b/src/module.rs index 3ee25995..7216c248 100644 --- a/src/module.rs +++ b/src/module.rs @@ -30,6 +30,7 @@ use crate::stdlib::{ }; #[cfg(not(feature = "no_std"))] +#[cfg(feature = "sync")] use crate::stdlib::sync::RwLock; /// Return type of module-level Rust function. diff --git a/src/packages/arithmetic.rs b/src/packages/arithmetic.rs index 8aeb1590..5e43c05b 100644 --- a/src/packages/arithmetic.rs +++ b/src/packages/arithmetic.rs @@ -8,6 +8,7 @@ use crate::token::Position; use crate::parser::FLOAT; #[cfg(not(feature = "no_float"))] +#[cfg(feature = "no_std")] use num_traits::*; use num_traits::{ diff --git a/src/packages/math_basic.rs b/src/packages/math_basic.rs index ca0bc374..aed7e5b7 100644 --- a/src/packages/math_basic.rs +++ b/src/packages/math_basic.rs @@ -7,6 +7,7 @@ use crate::token::Position; use crate::parser::FLOAT; #[cfg(not(feature = "no_float"))] +#[cfg(feature = "no_std")] use num_traits::*; use crate::stdlib::{boxed::Box, format, i32, i64}; diff --git a/tests/call_fn.rs b/tests/call_fn.rs index a04bd614..97767df7 100644 --- a/tests/call_fn.rs +++ b/tests/call_fn.rs @@ -1,7 +1,6 @@ #![cfg(not(feature = "no_function"))] use rhai::{ - Dynamic, Engine, EvalAltResult, FnPtr, Func, ImmutableString, Module, ParseError, - ParseErrorType, Scope, INT, + Dynamic, Engine, EvalAltResult, FnPtr, Func, Module, ParseError, ParseErrorType, Scope, INT, }; #[test]