From 7b387762550f64ffe2025d29d3232f2c6ed7546b Mon Sep 17 00:00:00 2001 From: lemonsh Date: Sun, 17 Jul 2022 12:40:20 +0200 Subject: [PATCH] Anonymous lifetime (thx missing) --- src/bot.rs | 3 +-- src/commands/eval.rs | 3 +-- src/commands/help.rs | 3 +-- src/commands/leek.rs | 9 +++------ src/commands/waifu.rs | 3 +-- 5 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/bot.rs b/src/bot.rs index f052cac..a1e33e2 100644 --- a/src/bot.rs +++ b/src/bot.rs @@ -19,8 +19,7 @@ pub trait Trigger { #[async_trait] pub trait Command { - //noinspection RsNeedlessLifetimes - async fn execute<'a>(&mut self, msg: Message<'a>) -> anyhow::Result; + async fn execute(&mut self, msg: Message<'_>) -> anyhow::Result; } pub struct Message<'a> { diff --git a/src/commands/eval.rs b/src/commands/eval.rs index e170420..00a9626 100644 --- a/src/commands/eval.rs +++ b/src/commands/eval.rs @@ -10,8 +10,7 @@ pub struct Eval { #[async_trait] impl Command for Eval { - //noinspection RsNeedlessLifetimes - async fn execute<'a>(&mut self, msg: Message<'a>) -> anyhow::Result { + async fn execute(&mut self, msg: Message<'_>) -> anyhow::Result { if let Some(expr) = msg.content { let last_eval = self.last_eval.entry(msg.author.into()).or_insert(0.0); let mut meval_ctx = Context::new(); diff --git a/src/commands/help.rs b/src/commands/help.rs index 5c2a1bb..eb68797 100644 --- a/src/commands/help.rs +++ b/src/commands/help.rs @@ -13,8 +13,7 @@ pub struct Help; #[async_trait] impl Command for Help { - //noinspection RsNeedlessLifetimes - async fn execute<'a>(&mut self, _msg: Message<'a>) -> anyhow::Result { + async fn execute(&mut self, _msg: Message<'_>) -> anyhow::Result { Ok(HELP.into()) } } diff --git a/src/commands/leek.rs b/src/commands/leek.rs index 4f7d037..0c2303e 100644 --- a/src/commands/leek.rs +++ b/src/commands/leek.rs @@ -130,24 +130,21 @@ pub struct Mock; #[async_trait] impl Command for Owo { - //noinspection RsNeedlessLifetimes - async fn execute<'a>(&mut self, msg: Message<'a>) -> anyhow::Result { + async fn execute(&mut self, msg: Message<'_>) -> anyhow::Result { execute_leek(LeekCommand::Owo, &msg).await } } #[async_trait] impl Command for Leet { - //noinspection RsNeedlessLifetimes - async fn execute<'a>(&mut self, msg: Message<'a>) -> anyhow::Result { + async fn execute(&mut self, msg: Message<'_>) -> anyhow::Result { execute_leek(LeekCommand::Leet, &msg).await } } #[async_trait] impl Command for Mock { - //noinspection RsNeedlessLifetimes - async fn execute<'a>(&mut self, msg: Message<'a>) -> anyhow::Result { + async fn execute(&mut self, msg: Message<'_>) -> anyhow::Result { execute_leek(LeekCommand::Mock, &msg).await } } diff --git a/src/commands/waifu.rs b/src/commands/waifu.rs index cadc74c..95a6ac0 100644 --- a/src/commands/waifu.rs +++ b/src/commands/waifu.rs @@ -10,8 +10,7 @@ pub struct Waifu { #[async_trait] impl Command for Waifu { - //noinspection RsNeedlessLifetimes - async fn execute<'a>(&mut self, msg: Message<'a>) -> anyhow::Result { + async fn execute(&mut self, msg: Message<'_>) -> anyhow::Result { let category = msg.content.unwrap_or("waifu"); let request = self.http.get(format!("https://api.waifu.pics/sfw/{}", category)).build()?; let response = self.http.execute(request)