Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
codingkarthik committed Sep 16, 2024
1 parent b723a16 commit bad18f9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
21 changes: 12 additions & 9 deletions crates/configuration/src/version1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ async fn configure_stored_procedures(
match config_options {
Some(config_options) => {
let stored_procedures_row =
select_first_row(&mssql_pool, STORED_PROCS_CONFIGURATION_QUERY).await;
select_first_row(mssql_pool, STORED_PROCS_CONFIGURATION_QUERY).await;
let introspected_stored_procedures: Vec<introspection::IntrospectStoredProcedure> =
serde_json::from_str(stored_procedures_row.get(0).unwrap())
.map_err(Error::StoredProcedureIntrospectionError)?;
Expand All @@ -191,15 +191,18 @@ async fn configure_stored_procedures(
let mut merged_stored_procedures = existing_stored_procedures.0.clone();
for (name, stored_procedure) in new_stored_procedures.0 {
// check if the stored procedure already exists
if merged_stored_procedures.contains_key(&name) {
if config_options.overwrite_existing_stored_procedures {
merged_stored_procedures.insert(name, stored_procedure);
} else {
// do not overwrite the existing stored procedure
continue;
match merged_stored_procedures.entry(name) {
std::collections::btree_map::Entry::Occupied(mut e) => {
if config_options.overwrite_existing_stored_procedures {
e.insert(stored_procedure);
} else {
// do not overwrite the existing stored procedure
continue;
}
}
std::collections::btree_map::Entry::Vacant(e) => {
e.insert(stored_procedure);
}
} else {
merged_stored_procedures.insert(name, stored_procedure);
}
}

Expand Down
6 changes: 2 additions & 4 deletions crates/ndc-sqlserver/tests/common/fresh_deployments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,8 @@ impl FreshDeployment {
.expect("Error initializing the newly created DB");

Check warning on line 53 in crates/ndc-sqlserver/tests/common/fresh_deployments.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/ndc-sqlserver/ndc-sqlserver/crates/ndc-sqlserver/tests/common/fresh_deployments.rs

Check warning on line 53 in crates/ndc-sqlserver/tests/common/fresh_deployments.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/ndc-sqlserver/ndc-sqlserver/crates/ndc-sqlserver/tests/common/fresh_deployments.rs

Check warning on line 53 in crates/ndc-sqlserver/tests/common/fresh_deployments.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/ndc-sqlserver/ndc-sqlserver/crates/ndc-sqlserver/tests/common/fresh_deployments.rs

Check warning on line 53 in crates/ndc-sqlserver/tests/common/fresh_deployments.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/ndc-sqlserver/ndc-sqlserver/crates/ndc-sqlserver/tests/common/fresh_deployments.rs

Check warning on line 53 in crates/ndc-sqlserver/tests/common/fresh_deployments.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/ndc-sqlserver/ndc-sqlserver/crates/ndc-sqlserver/tests/common/fresh_deployments.rs

Check warning on line 53 in crates/ndc-sqlserver/tests/common/fresh_deployments.rs

View workflow job for this annotation

GitHub Actions / cargo fmt

Diff in /home/runner/work/ndc-sqlserver/ndc-sqlserver/crates/ndc-sqlserver/tests/common/fresh_deployments.rs

for file_path in data_setup_file_paths.into_iter() {
let query = fs::read_to_string(file_path.clone()).expect(&format!(
"Failed to read file from {}",
file_path.to_str().unwrap()
));
let query = fs::read_to_string(file_path.clone()).unwrap_or_else(|_| panic!("Failed to read file from {}",
file_path.to_str().unwrap()));

new_db_connection
.simple_query(query)
Expand Down

0 comments on commit bad18f9

Please sign in to comment.