prefer where syntax

This commit is contained in:
Andy Weidenbaum 2021-03-24 07:53:43 +11:00
parent 406c84dabf
commit 0b09ac03d6

View File

@ -25,7 +25,10 @@ impl Searcher {
}
impl UserData for Searcher {
fn add_methods<'lua, M: UserDataMethods<'lua, Self>>(methods: &mut M) {
fn add_methods<'lua, M>(methods: &mut M)
where
M: UserDataMethods<'lua, Self>,
{
methods.add_meta_method(MetaMethod::Call, |lua_ctx, this, name: String| {
match this.modules.get(&name) {
Some(content) => Ok(Value::Function(
@ -55,7 +58,10 @@ impl StaticSearcher {
}
impl UserData for StaticSearcher {
fn add_methods<'lua, M: UserDataMethods<'lua, Self>>(methods: &mut M) {
fn add_methods<'lua, M>(methods: &mut M)
where
M: UserDataMethods<'lua, Self>,
{
methods.add_meta_method(MetaMethod::Call, |lua_ctx, this, name: String| {
match this.modules.get(name.as_str()) {
Some(content) => Ok(Value::Function(
@ -108,7 +114,10 @@ impl<P> UserData for PathSearcherPoly<P>
where
P: 'static + AsRef<Path> + Send,
{
fn add_methods<'lua, M: UserDataMethods<'lua, Self>>(methods: &mut M) {
fn add_methods<'lua, M>(methods: &mut M)
where
M: UserDataMethods<'lua, Self>,
{
methods.add_meta_method(MetaMethod::Call, |lua_ctx, this, name: String| {
match this.modules.get(&name) {
Some(ref path) => {