This commit is contained in:
Stephen Chung
2022-07-20 21:09:03 +08:00
18 changed files with 42 additions and 47 deletions

View File

@@ -268,7 +268,7 @@ impl Engine {
// Check for data race.
#[cfg(not(feature = "no_closure"))]
crate::func::call::ensure_no_data_race(name, &mut args, false)?;
crate::func::call::ensure_no_data_race(name, &args, false)?;
let lib = &[ast.as_ref()];
let fn_def = ast

View File

@@ -149,7 +149,7 @@ impl Expression<'_> {
impl AsRef<Expr> for Expression<'_> {
#[inline(always)]
fn as_ref(&self) -> &Expr {
&self.0
self.0
}
}
@@ -158,7 +158,7 @@ impl Deref for Expression<'_> {
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
self.0
}
}
@@ -178,7 +178,7 @@ impl Engine {
///
/// Not available under `no_custom_syntax`.
///
/// * `symbols` holds a slice of strings that define the custom syntax.
/// * `symbols` holds a slice of strings that define the custom syntax.
/// * `scope_may_be_changed` specifies variables _may_ be added/removed by this custom syntax.
/// * `func` is the implementation function.
///
@@ -365,8 +365,7 @@ impl Engine {
parse: Box::new(parse),
func: Box::new(func),
scope_may_be_changed,
}
.into(),
},
);
self
}

View File

@@ -102,8 +102,8 @@ fn map_std_type_name(name: &str, shorthands: bool) -> &str {
};
}
if name.starts_with("rhai::") {
map_std_type_name(&name[6..], shorthands)
if let Some(stripped) = name.strip_prefix("rhai::") {
map_std_type_name(stripped, shorthands)
} else {
name
}