aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Perry <np@nathanperry.dev>2024-08-16 05:18:39 -0400
committerNathan Perry <np@nathanperry.dev>2024-08-16 05:18:39 -0400
commit728d951b87ae9ba15ca1453d24ce9ce618badd5a (patch)
tree55f77c3d9c3fe0f7d659161fa85c729981cee27b
parent7d47be4c40ac8f9a9c33ae8c78e44d20c2c46ef6 (diff)
repo: apply rustfmt
-rw-r--r--calc/src/lib.rs2
-rw-r--r--src/bot.rs10
-rw-r--r--src/commands/today/halloween.rs14
-rw-r--r--src/commands/today/nov_5.rs14
-rw-r--r--src/commands/today/pianoman.rs13
-rw-r--r--src/commands/today/prelude.rs3
-rw-r--r--src/commands/today/thursday.rs6
-rw-r--r--src/commands/today/tomorrow.rs14
-rw-r--r--src/commands/today/wednesday.rs6
-rw-r--r--src/util/mod.rs6
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<Rule>) -> Result<f64, Error> {
(0..dice_count)
.map(|_| rng.gen_range(1..(dice_faces + 1)))
.sum::<usize>() 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<PoiseData, anyhow::Error>) -> 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<PoiseData, anyhow::Error>) -> 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<PoiseData, anyhow::Error>) -> BoxFuture<()> {
return;
}
}
- }
+ },
_ => "BANIC".to_string(),
};
@@ -377,7 +377,7 @@ fn check(ctx: PoiseContext) -> BoxFuture<anyhow::Result<bool>> {
})
}
-fn before_handle<'fut>(ctx: PoiseContext<'fut>) -> Pin<Box<dyn Future<Output=()> + Send + 'fut>> {
+fn before_handle<'fut>(ctx: PoiseContext<'fut>) -> Pin<Box<dyn Future<Output = ()> + 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<TodayArgs> = vec![
- TodayArgs {
- url: "https://www.youtube.com/watch?v=-1dSY6ZuXEY",
- ..Default::default()
- },
- ];
+ static ref HALLOWEEN: Vec<TodayArgs> = 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<TodayArgs> = vec![
- by_url("https://www.youtube.com/watch?v=gxEPV4kolz0"),
- TodayArgs {
- url: "https://www.youtube.com/watch?v=gxEPV4kolz0",
+ static ref PIANOMANS: Vec<TodayArgs> =
+ 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<bool> {
pub fn msg<U, E>(ctx: poise::Context<'_, U, E>) -> Option<&Message> {
match ctx {
poise::Context::Prefix(poise::PrefixContext {
- msg,
- ..
- }) => Some(msg),
+ msg,
+ ..
+ }) => Some(msg),
_ => None,
}
}