Reduce usage of as_ref and as_mut.

This commit is contained in:
Stephen Chung
2022-07-05 16:26:38 +08:00
parent 9319f87a7b
commit b6528bd51d
33 changed files with 211 additions and 137 deletions

View File

@@ -987,8 +987,9 @@ impl Engine {
module: Shared<Module>,
) {
let separator = crate::tokenizer::Token::DoubleColon.syntax();
let separator = separator.as_ref();
if !name.contains(separator.as_ref()) {
if !name.contains(separator) {
if !module.is_indexed() {
// Index the module (making a clone copy if necessary) if it is not indexed
let mut module = crate::func::shared_take_or_clone(module);
@@ -998,7 +999,7 @@ impl Engine {
root.insert(name.into(), module);
}
} else {
let mut iter = name.splitn(2, separator.as_ref());
let mut iter = name.splitn(2, separator);
let sub_module = iter.next().expect("contains separator").trim();
let remainder = iter.next().expect("contains separator").trim();