Massive lint fix

This commit is contained in:
Natsu Kagami 2023-10-22 17:45:13 +02:00
parent 1a6039aa94
commit 54502ad61b
Signed by: nki
GPG key ID: 55A032EB38B49ADB
28 changed files with 117 additions and 122 deletions

View file

@ -159,7 +159,7 @@ impl AnnouncerHandler {
let after = tokio::time::sleep_until(tokio::time::Instant::now() + cooldown);
join_all(self.announcers.iter().map(|(key, announcer)| {
eprintln!(" - scanning key `{}`", key);
Self::announce(self.data.clone(), self.cache_http.clone(), *key, announcer).map(
Self::announce(self.data.clone(), self.cache_http.clone(), key, announcer).map(
move |v| {
if let Err(e) = v {
eprintln!(" - key `{}`: {:?}", *key, e)
@ -241,9 +241,9 @@ pub async fn register_announcer(ctx: &Context, m: &Message, mut args: Args) -> C
.await?;
return Ok(());
}
let guild = m.guild(&ctx).expect("Guild-only command");
let guild = m.guild(ctx).expect("Guild-only command");
let channel = m.channel_id.to_channel(&ctx).await?;
AnnouncerChannels::open(&*data)
AnnouncerChannels::open(&data)
.borrow_mut()?
.entry(key.clone())
.or_default()
@ -284,8 +284,8 @@ pub async fn remove_announcer(ctx: &Context, m: &Message, mut args: Args) -> Com
.await?;
return Ok(());
}
let guild = m.guild(&ctx).expect("Guild-only command");
AnnouncerChannels::open(&*data)
let guild = m.guild(ctx).expect("Guild-only command");
AnnouncerChannels::open(&data)
.borrow_mut()?
.entry(key.clone())
.and_modify(|m| {

View file

@ -138,12 +138,12 @@ mod duration {
let tests = [
(
"2D2h1m",
StdDuration::from_secs(2 * 60 * 60 * 24 + 2 * 60 * 60 + 1 * 60),
StdDuration::from_secs(2 * 60 * 60 * 24 + 2 * 60 * 60 + 60),
),
(
"1W2D3h4m5s",
StdDuration::from_secs(
1 * 7 * 24 * 60 * 60 + // 1W
7 * 24 * 60 * 60 + // 1W
2 * 24 * 60 * 60 + // 2D
3 * 60 * 60 + // 3h
4 * 60 + // 4m
@ -153,7 +153,7 @@ mod duration {
(
"1W2D3h4m5s6W",
StdDuration::from_secs(
1 * 7 * 24 * 60 * 60 + // 1W
7 * 24 * 60 * 60 + // 1W
2 * 24 * 60 * 60 + // 2D
3 * 60 * 60 + // 3h
4 * 60 + // 4m

View file

@ -23,7 +23,7 @@ impl Flags {
pub fn collect_from(args: &mut Args) -> Flags {
let mut set = Set::new();
loop {
if let Some(Flag(s)) = args.find().ok() {
if let Ok(Flag(s)) = args.find() {
set.insert(s);
} else {
break Flags(set);

View file

@ -102,7 +102,7 @@ async fn paginate_with_first_message(
mut message: Message,
timeout: std::time::Duration,
) -> Result<()> {
pager.prerender(&ctx, &mut message).await?;
pager.prerender(ctx, &mut message).await?;
pager.render(0, ctx, &mut message).await?;
// Just quit if there is only one page
if pager.len().filter(|&v| v == 1).is_some() {
@ -127,7 +127,7 @@ async fn paginate_with_first_message(
.await?;
}
// Build a reaction collector
let mut reaction_collector = message.await_reactions(&ctx).removed(true).build();
let mut reaction_collector = message.await_reactions(ctx).removed(true).build();
let mut page = 0;
// Loop the handler function.