Anonymous lifetime (thx missing)

This commit is contained in:
lemonsh 2022-07-17 12:40:20 +02:00
parent dc66196615
commit 7b38776255
5 changed files with 7 additions and 14 deletions

View file

@ -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<String>;
async fn execute(&mut self, msg: Message<'_>) -> anyhow::Result<String>;
}
pub struct Message<'a> {

View file

@ -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<String> {
async fn execute(&mut self, msg: Message<'_>) -> anyhow::Result<String> {
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();

View file

@ -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<String> {
async fn execute(&mut self, _msg: Message<'_>) -> anyhow::Result<String> {
Ok(HELP.into())
}
}

View file

@ -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<String> {
async fn execute(&mut self, msg: Message<'_>) -> anyhow::Result<String> {
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<String> {
async fn execute(&mut self, msg: Message<'_>) -> anyhow::Result<String> {
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<String> {
async fn execute(&mut self, msg: Message<'_>) -> anyhow::Result<String> {
execute_leek(LeekCommand::Mock, &msg).await
}
}

View file

@ -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<String> {
async fn execute(&mut self, msg: Message<'_>) -> anyhow::Result<String> {
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)