From 8c8bd29d0d412c68b20bb15125bde389b789c6bf Mon Sep 17 00:00:00 2001 From: Andy Weidenbaum Date: Mon, 15 Feb 2021 11:40:48 +1100 Subject: [PATCH] prefer as_str() credit - https://www.fpcomplete.com/blog/avoiding-duplicating-strings-rust/ --- src/searcher.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/searcher.rs b/src/searcher.rs index 6e04ac1..12ea994 100644 --- a/src/searcher.rs +++ b/src/searcher.rs @@ -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)