From cbb0503e11a05618c5b5cdd4c7a5b892f78a0ec3 Mon Sep 17 00:00:00 2001 From: Chris Chang <51393127+chriscerie@users.noreply.github.com> Date: Sat, 21 Oct 2023 14:32:36 -0700 Subject: [PATCH] Fix clippy error (#562) --- selene-lib/src/lints/if_same_then_else.rs | 4 ++-- selene/src/validate_config.rs | 20 +++++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/selene-lib/src/lints/if_same_then_else.rs b/selene-lib/src/lints/if_same_then_else.rs index 502e1bbf..c8874b9c 100644 --- a/selene-lib/src/lints/if_same_then_else.rs +++ b/selene-lib/src/lints/if_same_then_else.rs @@ -55,8 +55,8 @@ impl Visitor for IfSameThenElseVisitor { fn visit_if(&mut self, if_block: &ast::If) { let else_ifs = if_block .else_if() - .map(|else_ifs| else_ifs.iter().collect()) - .unwrap_or_else(Vec::new); + .map(|else_ifs| else_ifs.iter().collect::>()) + .unwrap_or_default(); let mut blocks = Vec::with_capacity(2 + else_ifs.len()); blocks.push(if_block.block()); diff --git a/selene/src/validate_config.rs b/selene/src/validate_config.rs index b552e306..074522ab 100644 --- a/selene/src/validate_config.rs +++ b/selene/src/validate_config.rs @@ -120,7 +120,9 @@ pub fn validate_config( ErrorRange { start, end } }); - let Err(error) = crate::standard_library::collect_standard_library(&config, config.std(), directory, &None) else { + let Err(error) = + crate::standard_library::collect_standard_library(&config, config.std(), directory, &None) + else { return Ok(()); }; @@ -185,16 +187,16 @@ mod tests { let Err(validate_result) = validate_config(&config_path, &config_contents, &validate_config_test.path()) - else { - tests_pass = false; + else { + tests_pass = false; - eprintln!( - "{} did not error", - validate_config_test.file_name().to_string_lossy() - ); + eprintln!( + "{} did not error", + validate_config_test.file_name().to_string_lossy() + ); - continue; - }; + continue; + }; let mut rich_output_buffer = termcolor::NoColor::new(Vec::new()); validate_result