Small fixups.

This commit is contained in:
Stephen Chung 2020-07-20 23:23:12 +08:00
parent a5fa8322e9
commit e8b6d0143d
6 changed files with 5 additions and 4 deletions

View File

@ -18,7 +18,6 @@ use crate::stdlib::{
boxed::Box, boxed::Box,
collections::HashMap, collections::HashMap,
fmt, fmt,
hash::Hash,
string::String, string::String,
vec::Vec, vec::Vec,
}; };

View File

@ -710,7 +710,7 @@ impl Engine {
/// This function restores the first argument that was replaced by `normalize_first_arg_of_method_call`. /// 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>) { fn restore_first_arg<'a>(old_this_ptr: Option<&'a mut Dynamic>, args: &mut FnCallArgs<'a>) {
if let Some(this_pointer) = old_this_ptr { if let Some(this_pointer) = old_this_ptr {
mem::replace(args.get_mut(0).unwrap(), this_pointer); args[0] = this_pointer;
} }
} }

View File

@ -30,6 +30,7 @@ use crate::stdlib::{
}; };
#[cfg(not(feature = "no_std"))] #[cfg(not(feature = "no_std"))]
#[cfg(feature = "sync")]
use crate::stdlib::sync::RwLock; use crate::stdlib::sync::RwLock;
/// Return type of module-level Rust function. /// Return type of module-level Rust function.

View File

@ -8,6 +8,7 @@ use crate::token::Position;
use crate::parser::FLOAT; use crate::parser::FLOAT;
#[cfg(not(feature = "no_float"))] #[cfg(not(feature = "no_float"))]
#[cfg(feature = "no_std")]
use num_traits::*; use num_traits::*;
use num_traits::{ use num_traits::{

View File

@ -7,6 +7,7 @@ use crate::token::Position;
use crate::parser::FLOAT; use crate::parser::FLOAT;
#[cfg(not(feature = "no_float"))] #[cfg(not(feature = "no_float"))]
#[cfg(feature = "no_std")]
use num_traits::*; use num_traits::*;
use crate::stdlib::{boxed::Box, format, i32, i64}; use crate::stdlib::{boxed::Box, format, i32, i64};

View File

@ -1,7 +1,6 @@
#![cfg(not(feature = "no_function"))] #![cfg(not(feature = "no_function"))]
use rhai::{ use rhai::{
Dynamic, Engine, EvalAltResult, FnPtr, Func, ImmutableString, Module, ParseError, Dynamic, Engine, EvalAltResult, FnPtr, Func, Module, ParseError, ParseErrorType, Scope, INT,
ParseErrorType, Scope, INT,
}; };
#[test] #[test]