Use fluent style.

This commit is contained in:
Stephen Chung
2022-12-09 10:04:44 +08:00
parent a391f26920
commit 3d5908480a
6 changed files with 92 additions and 101 deletions

View File

@@ -205,12 +205,12 @@ impl Engine {
}
// First check script-defined functions
let result = global.lib.iter().any(|m| m.contains_fn(hash_script))
let r = global.lib.iter().any(|m| m.contains_fn(hash_script))
// Then check the global namespace and packages
|| self.global_modules.iter().any(|m| m.contains_fn(hash_script));
#[cfg(not(feature = "no_module"))]
let result = result ||
let r = r ||
// Then check imported modules
global.contains_qualified_fn(hash_script)
// Then check sub-modules
@@ -218,11 +218,11 @@ impl Engine {
m.values().any(|m| m.contains_qualified_fn(hash_script))
});
if !result && !cache.filter.is_absent_and_set(hash_script) {
if !r && !cache.filter.is_absent_and_set(hash_script) {
// Do not cache "one-hit wonders"
cache.map.insert(hash_script, None);
}
result
r
}
}