From 8eb6c821d4687ed40fda31cf9125ebaa02e9ce91 Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Sat, 17 Oct 2020 14:08:59 +0800 Subject: [PATCH] Fix tests. --- src/module/mod.rs | 24 ------------------------ src/packages/mod.rs | 7 ------- 2 files changed, 31 deletions(-) diff --git a/src/module/mod.rs b/src/module/mod.rs index 5ad7c3a5..d7cc40d9 100644 --- a/src/module/mod.rs +++ b/src/module/mod.rs @@ -425,30 +425,6 @@ impl Module { } } - /// Does the particular Rust function exist in the module? - /// - /// The `u64` hash is calculated by the function `crate::calc_fn_hash`. - /// It is also returned by the `set_fn_XXX` calls. - /// - /// # Examples - /// - /// ``` - /// use rhai::Module; - /// - /// let mut module = Module::new(); - /// module.set_fn_0("calc", || Ok(42_i64)); - /// assert!(module.contains_fn_with_name("calc", true)); - /// ``` - #[inline] - #[allow(dead_code)] - pub(crate) fn contains_fn_with_name(&self, fn_name: &str, public_only: bool) -> bool { - self.functions - .values() - .filter(|(_, access, _, _, _)| !public_only || access.is_public()) - .find(|(name, _, _, _, _)| name == fn_name) - .is_some() - } - /// Set a Rust function into the module, returning a hash key. /// /// If there is an existing Rust function of the same hash, it is replaced. diff --git a/src/packages/mod.rs b/src/packages/mod.rs index 1bc33737..d7c7d023 100644 --- a/src/packages/mod.rs +++ b/src/packages/mod.rs @@ -65,13 +65,6 @@ impl PackagesCollection { pub fn contains_fn(&self, hash: u64, public_only: bool) -> bool { self.0.iter().any(|p| p.contains_fn(hash, public_only)) } - /// Does the specified function name exist in the `PackagesCollection`? - #[allow(dead_code)] - pub fn contains_fn_with_name(&self, fn_name: &str, public_only: bool) -> bool { - self.0 - .iter() - .any(|p| p.contains_fn_with_name(fn_name, public_only)) - } /// Get specified function via its hash key. pub fn get_fn(&self, hash: u64, public_only: bool) -> Option<&CallableFunction> { self.0