prefer as_str()

credit
- https://www.fpcomplete.com/blog/avoiding-duplicating-strings-rust/
This commit is contained in:
Andy Weidenbaum 2021-02-15 11:40:48 +11:00
parent 4aa2f52dd7
commit 8c8bd29d0d

View File

@ -56,7 +56,7 @@ impl StaticSearcher {
impl UserData for StaticSearcher {
fn add_methods<'lua, M: UserDataMethods<'lua, Self>>(methods: &mut M) {
methods.add_meta_method(MetaMethod::Call, |lua_ctx, this, name: String| {
match this.modules.get(&name as &str) {
match this.modules.get(&name.as_str()) {
Some(content) => Ok(Value::Function(
lua_ctx
.load(content)