From 728d951b87ae9ba15ca1453d24ce9ce618badd5a Mon Sep 17 00:00:00 2001 From: Nathan Perry Date: Fri, 16 Aug 2024 05:18:39 -0400 Subject: repo: apply rustfmt --- calc/src/lib.rs | 2 +- src/bot.rs | 10 +++++----- src/commands/today/halloween.rs | 14 +++++--------- src/commands/today/nov_5.rs | 14 +++++--------- src/commands/today/pianoman.rs | 13 +++++-------- src/commands/today/prelude.rs | 3 +-- src/commands/today/thursday.rs | 6 +----- src/commands/today/tomorrow.rs | 14 +++++--------- src/commands/today/wednesday.rs | 6 +----- src/util/mod.rs | 6 +++--- 10 files changed, 32 insertions(+), 56 deletions(-) diff --git a/calc/src/lib.rs b/calc/src/lib.rs index c3ca3fd..ac8343e 100644 --- a/calc/src/lib.rs +++ b/calc/src/lib.rs @@ -157,7 +157,7 @@ fn eval_expr(p: Pairs) -> Result { (0..dice_count) .map(|_| rng.gen_range(1..(dice_faces + 1))) .sum::() as f64 - }, + } _ => unreachable!(), }; diff --git a/src/bot.rs b/src/bot.rs index 0c44349..ec0bf92 100644 --- a/src/bot.rs +++ b/src/bot.rs @@ -258,11 +258,11 @@ fn on_err(err: FrameworkError) -> BoxFuture<()> { } else { return; } - } + }, Err(e) => { error!("processing unrecognized message: {e}"); "BANIC".to_string() - } + }, } } else { if let Err(e) = commands::meme::invoke::_meme( @@ -270,7 +270,7 @@ fn on_err(err: FrameworkError) -> BoxFuture<()> { msg_content, Default::default(), ) - .await + .await { error!("producing meme for unrecognized: {e}"); "BANIC".to_string() @@ -278,7 +278,7 @@ fn on_err(err: FrameworkError) -> BoxFuture<()> { return; } } - } + }, _ => "BANIC".to_string(), }; @@ -377,7 +377,7 @@ fn check(ctx: PoiseContext) -> BoxFuture> { }) } -fn before_handle<'fut>(ctx: PoiseContext<'fut>) -> Pin + Send + 'fut>> { +fn before_handle<'fut>(ctx: PoiseContext<'fut>) -> Pin + Send + 'fut>> { debug!( "got command '{}' from user '{}' ({})", ctx.command().name, diff --git a/src/commands/today/halloween.rs b/src/commands/today/halloween.rs index 3fb1c18..f09146b 100644 --- a/src/commands/today/halloween.rs +++ b/src/commands/today/halloween.rs @@ -1,12 +1,10 @@ use super::prelude::*; lazy_static! { - static ref HALLOWEEN: Vec = vec![ - TodayArgs { - url: "https://www.youtube.com/watch?v=-1dSY6ZuXEY", - ..Default::default() - }, - ]; + static ref HALLOWEEN: Vec = vec![TodayArgs { + url: "https://www.youtube.com/watch?v=-1dSY6ZuXEY", + ..Default::default() + },]; } pub fn halloween(date: chrono::NaiveDateTime) -> TodayIter { @@ -14,7 +12,5 @@ pub fn halloween(date: chrono::NaiveDateTime) -> TodayIter { return Box::new(empty()); } - Box::new( - HALLOWEEN.iter().cloned() - ) + Box::new(HALLOWEEN.iter().cloned()) } diff --git a/src/commands/today/nov_5.rs b/src/commands/today/nov_5.rs index b4eafc9..f46c126 100644 --- a/src/commands/today/nov_5.rs +++ b/src/commands/today/nov_5.rs @@ -5,13 +5,9 @@ pub fn nov_5(date: chrono::NaiveDateTime) -> TodayIter { return Box::new(empty()); } - Box::new( - once( - TodayArgs { - url: "https://www.youtube.com/watch?v=LF1951pENdk", - start: Some(Duration::seconds(25)), - end: Some(Duration::seconds(39)), - } - ) - ) + Box::new(once(TodayArgs { + url: "https://www.youtube.com/watch?v=LF1951pENdk", + start: Some(Duration::seconds(25)), + end: Some(Duration::seconds(39)), + })) } diff --git a/src/commands/today/pianoman.rs b/src/commands/today/pianoman.rs index e3a997f..22e8b61 100644 --- a/src/commands/today/pianoman.rs +++ b/src/commands/today/pianoman.rs @@ -3,15 +3,12 @@ use super::prelude::*; lazy_static! { static ref NINE_AM: chrono::NaiveTime = chrono::NaiveTime::from_hms_opt(9, 0, 0).unwrap(); static ref NINE_PM: chrono::NaiveTime = chrono::NaiveTime::from_hms_opt(21, 0, 0).unwrap(); - - static ref PIANOMANS: Vec = vec![ - by_url("https://www.youtube.com/watch?v=gxEPV4kolz0"), - TodayArgs { - url: "https://www.youtube.com/watch?v=gxEPV4kolz0", + static ref PIANOMANS: Vec = + vec![by_url("https://www.youtube.com/watch?v=gxEPV4kolz0"), TodayArgs { + url: "https://www.youtube.com/watch?v=gxEPV4kolz0", start: Some(Duration::seconds(30)), - end: Some(Duration::seconds(34)), - } - ]; + end: Some(Duration::seconds(34)), + }]; } pub fn pianoman(dt: chrono::NaiveDateTime) -> TodayIter { diff --git a/src/commands/today/prelude.rs b/src/commands/today/prelude.rs index d5f470d..f02fffc 100644 --- a/src/commands/today/prelude.rs +++ b/src/commands/today/prelude.rs @@ -1,6 +1,6 @@ pub use std::iter::{ - once, empty, + once, }; pub use lazy_static::lazy_static; @@ -15,7 +15,6 @@ pub use super::{ TodayIter, }; - #[inline] pub fn month_day(date: chrono::NaiveDateTime) -> (u32, u32) { (date.month(), date.day()) diff --git a/src/commands/today/thursday.rs b/src/commands/today/thursday.rs index 0215293..f4c14af 100644 --- a/src/commands/today/thursday.rs +++ b/src/commands/today/thursday.rs @@ -5,9 +5,5 @@ pub fn thursday(date: chrono::NaiveDateTime) -> TodayIter { return Box::new(empty()); } - Box::new( - once( - by_url("https://www.youtube.com/watch?v=W6o44AfYWQE") - ) - ) + Box::new(once(by_url("https://www.youtube.com/watch?v=W6o44AfYWQE"))) } diff --git a/src/commands/today/tomorrow.rs b/src/commands/today/tomorrow.rs index ad5c37d..a483541 100644 --- a/src/commands/today/tomorrow.rs +++ b/src/commands/today/tomorrow.rs @@ -1,13 +1,9 @@ use super::prelude::*; pub fn tomorrow(_date: chrono::NaiveDateTime) -> TodayIter { - Box::new( - once( - TodayArgs { - url: "https://www.youtube.com/watch?v=W78AGkm_AtE", - start: None, - end: Some(Duration::seconds(6)) - } - ) - ) + Box::new(once(TodayArgs { + url: "https://www.youtube.com/watch?v=W78AGkm_AtE", + start: None, + end: Some(Duration::seconds(6)), + })) } diff --git a/src/commands/today/wednesday.rs b/src/commands/today/wednesday.rs index 0748a0b..d9bf81d 100644 --- a/src/commands/today/wednesday.rs +++ b/src/commands/today/wednesday.rs @@ -5,9 +5,5 @@ pub fn wednesday(date: chrono::NaiveDateTime) -> TodayIter { return Box::new(empty()); } - Box::new( - once( - by_url("https://www.youtube.com/watch?v=du-TY1GUFGk") - ) - ) + Box::new(once(by_url("https://www.youtube.com/watch?v=du-TY1GUFGk"))) } diff --git a/src/util/mod.rs b/src/util/mod.rs index d214957..b9e5f0f 100644 --- a/src/util/mod.rs +++ b/src/util/mod.rs @@ -69,9 +69,9 @@ pub async fn users_listening(ctx: &Context) -> anyhow::Result { pub fn msg(ctx: poise::Context<'_, U, E>) -> Option<&Message> { match ctx { poise::Context::Prefix(poise::PrefixContext { - msg, - .. - }) => Some(msg), + msg, + .. + }) => Some(msg), _ => None, } } -- cgit v1.3.1