Anonymous lifetime (thx missing)
This commit is contained in:
parent
dc66196615
commit
7b38776255
|
@ -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> {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue