Streamline string handling.

This commit is contained in:
Stephen Chung
2021-03-24 13:17:52 +08:00
parent 3a1e93e324
commit c4fe1782df
12 changed files with 129 additions and 82 deletions

View File

@@ -75,7 +75,7 @@ impl Imports {
.iter()
.enumerate()
.rev()
.find_map(|(i, key)| if key.as_str() == name { Some(i) } else { None })
.find_map(|(i, key)| if *key == name { Some(i) } else { None })
}
/// Push an imported [modules][Module] onto the stack.
#[inline(always)]
@@ -996,7 +996,7 @@ impl Engine {
};
// Check if the variable is `this`
if name.as_str() == KEYWORD_THIS {
if *name == KEYWORD_THIS {
return if let Some(val) = this_ptr {
Ok(((*val).into(), *pos))
} else {