diff --git a/src/ast.rs b/src/ast.rs index 0a69dd17..910352fe 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -7,9 +7,9 @@ use crate::stdlib::{ borrow::Cow, boxed::Box, fmt, - hash::{Hash, Hasher}, + hash::Hash, num::{NonZeroU64, NonZeroUsize}, - ops::{Add, AddAssign, Deref, DerefMut}, + ops::{Add, AddAssign}, string::String, vec, vec::Vec, @@ -1131,7 +1131,7 @@ pub struct FloatWrapper(FLOAT); #[cfg(not(feature = "no_float"))] impl Hash for FloatWrapper { - fn hash(&self, state: &mut H) { + fn hash(&self, state: &mut H) { self.0.to_le_bytes().hash(state); } } @@ -1151,7 +1151,7 @@ impl AsMut for FloatWrapper { } #[cfg(not(feature = "no_float"))] -impl Deref for FloatWrapper { +impl crate::stdlib::ops::Deref for FloatWrapper { type Target = FLOAT; fn deref(&self) -> &Self::Target { @@ -1160,7 +1160,7 @@ impl Deref for FloatWrapper { } #[cfg(not(feature = "no_float"))] -impl DerefMut for FloatWrapper { +impl crate::stdlib::ops::DerefMut for FloatWrapper { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } diff --git a/src/module/mod.rs b/src/module/mod.rs index c145e217..64788b74 100644 --- a/src/module/mod.rs +++ b/src/module/mod.rs @@ -1676,9 +1676,8 @@ impl Module { } /// Get an iterator to the functions in the [`Module`]. - #[cfg(not(feature = "no_optimize"))] - #[cfg(not(feature = "no_function"))] #[inline(always)] + #[allow(dead_code)] pub(crate) fn iter_fn(&self) -> impl Iterator { self.functions.values() } diff --git a/src/serde_impl/metadata.rs b/src/serde_impl/metadata.rs index 85a63d87..94fc32c6 100644 --- a/src/serde_impl/metadata.rs +++ b/src/serde_impl/metadata.rs @@ -145,7 +145,14 @@ impl From<&crate::module::FuncInfo> for FnMetadata { .or_else(|| Some("()".to_string())), signature: info.gen_signature(), doc_comments: if info.func.is_script() { - info.func.get_fn_def().comments.clone() + #[cfg(feature = "no_function")] + { + unreachable!() + } + #[cfg(not(feature = "no_function"))] + { + info.func.get_fn_def().comments.clone() + } } else { Default::default() }, @@ -212,7 +219,7 @@ impl Engine { /// 4) Functions in global modules (optional) pub fn gen_fn_metadata_with_ast_to_json( &self, - ast: &AST, + _ast: &AST, include_global: bool, ) -> serde_json::Result { let mut global: ModuleMetadata = Default::default(); @@ -233,7 +240,8 @@ impl Engine { .map(|f| f.into()) .for_each(|info| global.functions.push(info)); - ast.iter_functions() + #[cfg(not(feature = "no_function"))] + _ast.iter_functions() .map(|f| f.into()) .for_each(|info| global.functions.push(info));