prefer as_str()
credit - https://www.fpcomplete.com/blog/avoiding-duplicating-strings-rust/
This commit is contained in:
parent
4aa2f52dd7
commit
8c8bd29d0d
@ -56,7 +56,7 @@ impl StaticSearcher {
|
|||||||
impl UserData for StaticSearcher {
|
impl UserData for StaticSearcher {
|
||||||
fn add_methods<'lua, M: UserDataMethods<'lua, Self>>(methods: &mut M) {
|
fn add_methods<'lua, M: UserDataMethods<'lua, Self>>(methods: &mut M) {
|
||||||
methods.add_meta_method(MetaMethod::Call, |lua_ctx, this, name: String| {
|
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(
|
Some(content) => Ok(Value::Function(
|
||||||
lua_ctx
|
lua_ctx
|
||||||
.load(content)
|
.load(content)
|
||||||
|
Loading…
Reference in New Issue
Block a user