chore(clippy): fix clippy warnings (#2)

This commit is contained in:
Oskar 2022-07-09 14:33:00 +02:00 committed by GitHub
parent 42098b9db5
commit 740d5b5f39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -35,8 +35,8 @@ async fn get_configuration_lock(ctx: &Context) -> Arc<RwLock<Configuration>> {
.clone() .clone()
} }
fn contains_match(regex: &Vec<Regex>, text: &String) -> bool { fn contains_match(regex: &[Regex], text: &str) -> bool {
regex.iter().any(|r| r.is_match(&text)) regex.iter().any(|r| r.is_match(text))
} }
fn load_configuration() -> Configuration { fn load_configuration() -> Configuration {
@ -186,7 +186,7 @@ impl EventHandler for Handler {
} }
async fn thread_create(&self, ctx: Context, thread: GuildChannel) { 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."); trace!("Thread was joined. Block dispatch.");
return; return;
} }

View File

@ -15,7 +15,7 @@ impl Configuration {
fn save(&self) -> Result<(), Error> { fn save(&self) -> Result<(), Error> {
let mut file = File::create("configuration.json")?; let mut file = File::create("configuration.json")?;
let json = serde_json::to_string_pretty(&self)?; let json = serde_json::to_string_pretty(&self)?;
file.write(json.as_bytes())?; file.write_all(json.as_bytes())?;
Ok(()) Ok(())
} }