html terminal
run clippy
| -rw-r--r-- | src/bot/maps.rs | 2 | ||||
| -rw-r--r-- | src/bot/mod.rs | 4 | ||||
| -rw-r--r-- | src/bot/schematic.rs | 2 | ||||
| -rw-r--r-- | src/bot/voting.rs | 3 | ||||
| -rw-r--r-- | src/process.rs | 2 | ||||
| -rw-r--r-- | src/webhook.rs | 2 |
6 files changed, 7 insertions, 8 deletions
diff --git a/src/bot/maps.rs b/src/bot/maps.rs index ad8bbcc..89e363c 100644 --- a/src/bot/maps.rs +++ b/src/bot/maps.rs @@ -87,7 +87,7 @@ impl MapImage { Ok( if self .1 - .fetch_update(Relaxed, Relaxed, |then| (now > then + 70).then(|| now)) + .fetch_update(Relaxed, Relaxed, |then| (now > then + 70).then_some(now)) .is_err() { (lock, None) diff --git a/src/bot/mod.rs b/src/bot/mod.rs index a6d02e6..6912448 100644 --- a/src/bot/mod.rs +++ b/src/bot/mod.rs @@ -92,7 +92,7 @@ impl Bot { poise::Event::Message { new_message } => { if [1142100900442296441, 1003092765581787279] .contains(new_message.channel_id.as_u64()) - && !new_message.content.starts_with("!") + && !new_message.content.starts_with('!') && !new_message.content.starts_with(PFX) && !new_message.author.bot { @@ -103,7 +103,7 @@ impl Bot { .author_nick(&c.http) .await .unwrap_or_else(|| new_message.author.name.clone()), - new_message.content_safe(&c.cache).replace("\n", "; ") + new_message.content_safe(&c.cache).replace('\n', "; ") ) .is_err() { diff --git a/src/bot/schematic.rs b/src/bot/schematic.rs index 9098a59..41e6cd8 100644 --- a/src/bot/schematic.rs +++ b/src/bot/schematic.rs @@ -10,7 +10,7 @@ use std::path::Path; use std::sync::LazyLock; static RE: LazyLock<Regex> = - LazyLock::new(|| Regex::new(r#"(```)?(\n)?([^`]+)(\n)?(```)?"#).unwrap()); + LazyLock::new(|| Regex::new(r"(```)?(\n)?([^`]+)(\n)?(```)?").unwrap()); #[poise::command(context_menu_command = "Render schematic", category = "Info")] /// draw schematic. diff --git a/src/bot/voting.rs b/src/bot/voting.rs index 0c55682..2de5c96 100644 --- a/src/bot/voting.rs +++ b/src/bot/voting.rs @@ -101,8 +101,7 @@ macro_rules! votes { impl VoteData { pub fn summarize(&mut self, ctx: &Context<'_>, optcount: usize) -> Vec<usize> { - let mut ret = vec![]; - ret.resize(optcount, 0); + let mut ret = vec![0; optcount]; let mut v; for v in votes!(*self, ctx, v).values() { ret[*v] += 1; diff --git a/src/process.rs b/src/process.rs index 6950297..f9774fa 100644 --- a/src/process.rs +++ b/src/process.rs @@ -50,7 +50,7 @@ impl Process { }, Ok(mut s) => { input!("{s}"); - s.push_str("\n"); + s.push('\n'); self.inner.write_all(s.as_bytes()).await.unwrap(); self.inner.flush().await.unwrap(); } diff --git a/src/webhook.rs b/src/webhook.rs index 6fc2195..e0b24b4 100644 --- a/src/webhook.rs +++ b/src/webhook.rs @@ -102,7 +102,7 @@ impl<'a> Webhook<'a> { self.send_message("server", &format!("loading map {map}")) .await; } - _ => return, + _ => (), } } } |