From 740d5b5f39d504df9b18c20af60f3f9f5aea983a Mon Sep 17 00:00:00 2001 From: Oskar Date: Sat, 9 Jul 2022 14:33:00 +0200 Subject: [PATCH] chore(clippy): fix clippy warnings (#2) --- src/main.rs | 6 +++--- src/model/application.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index bf6b578..859f11a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -35,8 +35,8 @@ async fn get_configuration_lock(ctx: &Context) -> Arc> { .clone() } -fn contains_match(regex: &Vec, text: &String) -> bool { - regex.iter().any(|r| r.is_match(&text)) +fn contains_match(regex: &[Regex], text: &str) -> bool { + regex.iter().any(|r| r.is_match(text)) } fn load_configuration() -> Configuration { @@ -186,7 +186,7 @@ impl EventHandler for Handler { } async fn thread_create(&self, ctx: Context, thread: GuildChannel) { - if let Some(_) = thread.member { + if thread.member.is_some() { trace!("Thread was joined. Block dispatch."); return; } diff --git a/src/model/application.rs b/src/model/application.rs index 89d9381..86a8933 100644 --- a/src/model/application.rs +++ b/src/model/application.rs @@ -15,7 +15,7 @@ impl Configuration { fn save(&self) -> Result<(), Error> { let mut file = File::create("configuration.json")?; let json = serde_json::to_string_pretty(&self)?; - file.write(json.as_bytes())?; + file.write_all(json.as_bytes())?; Ok(()) }