From 43c0d6c38888d18f1a283a24de10d7a2b5fe0483 Mon Sep 17 00:00:00 2001 From: Stephen D <webmaster@scd31.com> Date: Wed, 19 Jul 2023 16:24:39 -0300 Subject: [PATCH] clippy fix --- src/handlers/xbasic.rs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/handlers/xbasic.rs b/src/handlers/xbasic.rs index 5bb6d59..cfcabb8 100644 --- a/src/handlers/xbasic.rs +++ b/src/handlers/xbasic.rs @@ -7,7 +7,7 @@ use serenity::async_trait; use serenity::model::channel::{AttachmentType, Message, ReactionType}; use serenity::model::id::UserId; use serenity::prelude::*; -use std::borrow::{Borrow, Cow}; +use std::borrow::Cow; use std::collections::HashMap; use std::str::FromStr; use std::sync::Arc; @@ -182,7 +182,7 @@ impl XbasicHandler { async fn list_saved_programs(&self, msg: &Message, ctx: &Context) -> Option<()> { let program_names = - Program::list_programs_by_user(self.conn.lock().await.borrow(), msg.author.id)?; + Program::list_programs_by_user(&*self.conn.lock().await, msg.author.id)?; msg.channel_id .say( &ctx, @@ -200,7 +200,7 @@ impl XbasicHandler { async fn list_published_programs(&self, msg: &Message, ctx: &Context) -> Option<()> { let program_names: Vec<String> = - Program::list_published_programs(self.conn.lock().await.borrow())? + Program::list_published_programs(&*self.conn.lock().await)? .iter() .map(|row| format!("{}\t{}", row.0, row.1)) .collect(); @@ -220,7 +220,7 @@ impl XbasicHandler { } async fn publish_program(&self, name: &str, msg: &Message, ctx: &Context) -> Option<()> { - Program::set_program_published(self.conn.lock().await.borrow(), name, msg.author.id, true)?; + Program::set_program_published(&*self.conn.lock().await, name, msg.author.id, true)?; msg.channel_id .say(&ctx, format!("Published {name}.")) @@ -231,12 +231,7 @@ impl XbasicHandler { } async fn unpublish_program(&self, name: &str, msg: &Message, ctx: &Context) -> Option<()> { - Program::set_program_published( - self.conn.lock().await.borrow(), - name, - msg.author.id, - false, - )?; + Program::set_program_published(&*self.conn.lock().await, name, msg.author.id, false)?; msg.channel_id .say(&ctx, format!("Unpublished {name}.")) @@ -248,7 +243,7 @@ impl XbasicHandler { async fn load_published_program(&self, msg: &Message, ctx: &Context, id: i32) -> Option<()> { let name = get_user_programs!(self, &msg.author.id) - .load_published_program(self.conn.lock().await.borrow(), id)?; + .load_published_program(&*self.conn.lock().await, id)?; msg.channel_id .say(&ctx, format!("Loaded {id} (\"{name}\") into memory.")) -- GitLab