From 8a5a841e619793ce81b177179694712284be23e4 Mon Sep 17 00:00:00 2001 From: Nathan Perry Date: Sun, 17 Nov 2019 23:51:56 -0500 Subject: borrowck fixes --- src/game.rs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/game.rs') diff --git a/src/game.rs b/src/game.rs index 3d3db24..31e19b7 100644 --- a/src/game.rs +++ b/src/game.rs @@ -25,7 +25,6 @@ use serenity::{ framework::standard::{ ArgError, Args, - CommandResult, macros::{command, group}, }, model::{ @@ -152,13 +151,13 @@ impl FromStr for GameStatus { #[command] #[aliases("installedgaem")] -pub fn installedgame(ctx: &mut Context, msg: &Message, args: Args) -> CommandResult { +pub fn installedgame(ctx: &mut Context, msg: &Message, args: Args) -> Result<()> { _game(ctx, msg, args, GameStatus::Installed) } #[command] #[aliases("ownedgaem")] -pub fn ownedgame(ctx: &mut Context, msg: &Message, args: Args) -> CommandResult { +pub fn ownedgame(ctx: &mut Context, msg: &Message, args: Args) -> Result<()> { _game(ctx, msg, args, GameStatus::NotInstalled) } @@ -215,17 +214,17 @@ pub fn get_user_id>(g: &Guild, s: S) -> StdResult CommandResult { +fn game(ctx: &mut Context, msg: &Message, args: Args) -> Result<()> { _game(ctx, msg, args, GameStatus::Installed) } -fn _game(ctx: &mut Context, msg: &Message, mut args: Args, min_status: GameStatus) -> CommandResult { - let guild = msg.channel_id.to_channel(ctx)? +fn _game(ctx: &mut Context, msg: &Message, mut args: Args, min_status: GameStatus) -> Result<()> { + let guild = msg.channel_id.to_channel(&ctx)? .guild() .ok_or(anyhow!("couldn't find guild"))?; let guild = guild.read() - .guild(ctx) + .guild(&ctx) .ok_or(anyhow!("couldn't find guild"))?; let guild = guild @@ -407,7 +406,7 @@ fn load_spreadsheet() -> Result>> { #[command] #[aliases("updategame")] -pub fn updategaem(ctx: &mut Context, msg: &Message, mut args: Args) -> CommandResult { +pub fn updategaem(ctx: &mut Context, msg: &Message, mut args: Args) -> Result<()> { use regex::Regex; let arg_user = args.single_quoted::(); @@ -417,12 +416,12 @@ pub fn updategaem(ctx: &mut Context, msg: &Message, mut args: Args) -> CommandRe } else { use std::borrow::Borrow; - let guild = msg.channel_id.to_channel(ctx)? + let guild = msg.channel_id.to_channel(&ctx)? .guild() .ok_or(anyhow!("couldn't find guild"))?; let guild = guild.read() - .guild(ctx) + .guild(&ctx) .ok_or(anyhow!("couldn't find guild"))?; let guild = guild -- cgit v1.3.1