Skip to content

Commit

Permalink
fix: various warnings & errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kawaemon committed Nov 2, 2022
1 parent 87550d2 commit 1340c26
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 12 deletions.
1 change: 0 additions & 1 deletion src/bot/alias/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use {
},
anyhow::Result,
async_trait::async_trait,
clap::{Args, CommandFactory},
};

const NAME: &str = "rusty_ponyo::bot::alias";
Expand Down
1 change: 0 additions & 1 deletion src/bot/auth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use {
crate::bot::{parse_command, ui, BotService, Context, Message},
anyhow::{Context as _, Result},
async_trait::async_trait,
clap::{Args, CommandFactory, Parser},
rand::{prelude::StdRng, Rng, SeedableRng},
sequoia_openpgp::{
cert::CertParser,
Expand Down
6 changes: 3 additions & 3 deletions src/bot/genkai_point/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use {
anyhow::{Context as _, Result},
async_trait::async_trait,
chrono::{DateTime, Duration, Utc},
clap::{ArgEnum, Args, CommandFactory},
clap::ValueEnum,
once_cell::sync::Lazy,
std::{cmp::Ordering, collections::HashMap, fmt::Write},
tokio::sync::Mutex,
Expand Down Expand Up @@ -51,12 +51,12 @@ enum Command {
#[clap(long, short)]
invert: bool,

#[clap(arg_enum, default_value_t=RankingBy::Point)]
#[clap(value_enum, default_value_t=RankingBy::Point)]
by: RankingBy,
},
}

#[derive(Debug, Copy, Clone, PartialEq, Eq, ArgEnum)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, ValueEnum)]
enum RankingBy {
Point,
Duration,
Expand Down
1 change: 0 additions & 1 deletion src/bot/gh/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use {
crate::bot::{parse_command, ui, BotService, Context, Message},
anyhow::{Context as _, Result},
async_trait::async_trait,
clap::{Args, CommandFactory, Parser},
derivative::Derivative,
once_cell::sync::Lazy,
regex::Regex,
Expand Down
6 changes: 3 additions & 3 deletions src/bot/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,17 @@ macro_rules! ui {
}

impl $name {
fn command<'a>() -> clap::Command<'a> {
fn command() -> clap::Command {
clap::Command::new($bot_name).bin_name($prefix)
}
}
impl clap::Parser for $name {}
impl clap::CommandFactory for $name {
fn into_app<'help>() -> clap::Command<'help> {
fn command() -> clap::Command {
use clap::Args;
Self::augment_args(Self::command())
}
fn into_app_for_update<'help>() -> clap::Command<'help> {
fn command_for_update() -> clap::Command {
use clap::Args;
Self::augment_args_for_update(Self::command())
}
Expand Down
5 changes: 5 additions & 0 deletions src/bot/vc_diff/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ impl VcDiffBot {
}

async fn should_notify(&self) -> bool {
if !*self.enabled.lock().await {
return false;
}

let mut timeout = self.timeout.lock().await;

let now = Utc::now();
Expand Down Expand Up @@ -116,6 +120,7 @@ impl BotService for VcDiffBot {
ctx.send_text_message(msg)
.await
.context("failed to send message")?;

Ok(())
}

Expand Down
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![feature(let_else)]
#![feature(let_chains)]

mod bot;
Expand All @@ -8,7 +7,7 @@ mod db;
use {
crate::bot::{
alias::MessageAliasBot, auth::GenkaiAuthBot, genkai_point::GenkaiPointBot,
gh::GitHubCodePreviewBot,
gh::GitHubCodePreviewBot, vc_diff::VcDiffBot,
},
anyhow::{Context as _, Result},
};
Expand Down Expand Up @@ -58,7 +57,8 @@ async fn main() -> Result<()> {
.add_service(MessageAliasBot::new(db.clone()))
.add_service(GenkaiPointBot::new(db.clone()))
.add_service(GitHubCodePreviewBot)
.add_service(GenkaiAuthBot::new(auth_db, pgp_whitelist));
.add_service(GenkaiAuthBot::new(auth_db, pgp_whitelist))
.add_service(VcDiffBot::new());

#[cfg(feature = "console_client")]
client.run().await?;
Expand Down

0 comments on commit 1340c26

Please sign in to comment.