Skip to content

Commit

Permalink
Fix clippy error (#562)
Browse files Browse the repository at this point in the history
  • Loading branch information
chriscerie authored Oct 21, 2023
1 parent 8f47168 commit cbb0503
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions selene-lib/src/lints/if_same_then_else.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<_>>())
.unwrap_or_default();

let mut blocks = Vec::with_capacity(2 + else_ifs.len());
blocks.push(if_block.block());
Expand Down
20 changes: 11 additions & 9 deletions selene/src/validate_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(());
};

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit cbb0503

Please sign in to comment.