Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clippy error #562

Merged
merged 2 commits into from
Oct 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading