From cba914db95bb6b5a6c176dab9a152a0186e5215a Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Mon, 7 Nov 2022 16:34:25 +0800 Subject: [PATCH] Fix no_function build. --- src/api/run.rs | 6 +++--- src/types/fn_ptr.rs | 8 +++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/api/run.rs b/src/api/run.rs index 96faee2e..34f1d106 100644 --- a/src/api/run.rs +++ b/src/api/run.rs @@ -122,12 +122,12 @@ impl Engine { let statements = ast.statements(); if !statements.is_empty() { - let lib = [ + let lib: &[crate::Shared] = &[ #[cfg(not(feature = "no_function"))] - AsRef::>::as_ref(ast).clone(), + AsRef::>::as_ref(ast).clone(), ]; let lib = if lib.first().map_or(true, |m| m.is_empty()) { - &lib[0..0] + &[][..] } else { &lib }; diff --git a/src/types/fn_ptr.rs b/src/types/fn_ptr.rs index 810dd5a8..b7ac5468 100644 --- a/src/types/fn_ptr.rs +++ b/src/types/fn_ptr.rs @@ -150,17 +150,15 @@ impl FnPtr { let mut arg_values = crate::StaticVec::new_const(); args.parse(&mut arg_values); - let lib = [ + let lib: &[crate::Shared] = &[ #[cfg(not(feature = "no_function"))] - AsRef::>::as_ref(ast).clone(), + AsRef::>::as_ref(ast).clone(), ]; let lib = if lib.first().map_or(true, |m| m.is_empty()) { - &lib[0..0] + &[][..] } else { &lib }; - #[cfg(feature = "no_function")] - let lib = &[]; #[allow(deprecated)] let ctx = NativeCallContext::new(engine, self.fn_name(), lib);