Use as_deref().

This commit is contained in:
Stephen Chung
2022-11-25 23:03:20 +08:00
parent d645d8271c
commit e8e1706d98
14 changed files with 36546 additions and 74 deletions

View File

@@ -368,8 +368,9 @@ impl Definitions<'_> {
let mut m = self
.engine
.global_sub_modules
.iter()
.flat_map(|m| m.iter())
.as_deref()
.into_iter()
.flatten()
.map(move |(name, module)| {
(
name.to_string(),

View File

@@ -743,7 +743,7 @@ impl Engine {
signatures.extend(self.global_namespace().gen_fn_signatures());
#[cfg(not(feature = "no_module"))]
for (name, m) in self.global_sub_modules.iter().flat_map(|m| m.iter()) {
for (name, m) in self.global_sub_modules.as_deref().into_iter().flatten() {
signatures.extend(m.gen_fn_signatures().map(|f| format!("{name}::{f}")));
}

View File

@@ -204,8 +204,9 @@ impl Engine {
#[cfg(not(feature = "no_module"))]
return self
.global_sub_modules
.iter()
.flat_map(|m| m.iter())
.as_deref()
.into_iter()
.flatten()
.find_map(|(_, m)| m.get_custom_type(name));
#[cfg(feature = "no_module")]
return None;
@@ -238,8 +239,9 @@ impl Engine {
#[cfg(not(feature = "no_module"))]
return self
.global_sub_modules
.iter()
.flat_map(|m| m.iter())
.as_deref()
.into_iter()
.flatten()
.find_map(|(_, m)| m.get_custom_type(name));
#[cfg(feature = "no_module")]
return None;