Skip to content

Commit

Permalink
fix: Fixed Clippy warnings from issue #55 (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pylyv committed Feb 25, 2024
1 parent 65a4965 commit 633ce4e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions canyon_connection/src/lib.rs
Expand Up @@ -94,7 +94,7 @@ pub fn get_database_connection<'a>(
guarded_cache
.get_mut(
DATASOURCES
.get(0)
.first()
.expect("We didn't found any valid datasource configuration. Check your `canyon.toml` file")
.name
.as_str()
Expand All @@ -113,7 +113,7 @@ pub fn get_database_config<'a>(
) -> &'a DatasourceConfig {
if datasource_name.is_empty() {
datasources_config
.get(0)
.first()
.unwrap_or_else(|| panic!("Not exist datasource"))
} else {
datasources_config
Expand Down
2 changes: 1 addition & 1 deletion canyon_migrations/src/migrations/processor.rs
Expand Up @@ -701,7 +701,7 @@ impl MigrationsHelper {
.collect::<Vec<String>>();

let table_to_reference = annotation_data
.get(0)
.first()
.expect("Error extracting table ref from FK annotation")
.to_string();
let column_to_reference = annotation_data
Expand Down
2 changes: 1 addition & 1 deletion tests/crud/querybuilder_operations.rs
Expand Up @@ -56,7 +56,7 @@ fn test_crud_find_with_querybuilder() {
let filtered_leagues: Vec<League> = filtered_leagues_result.unwrap();
assert!(!filtered_leagues.is_empty());

let league_idx_0 = filtered_leagues.get(0).unwrap();
let league_idx_0 = filtered_leagues.first().unwrap();
assert_eq!(league_idx_0.id, 34);
assert_eq!(league_idx_0.region, "KOREA");
}
Expand Down
10 changes: 5 additions & 5 deletions tests/migrations/mod.rs
Expand Up @@ -14,16 +14,16 @@ fn test_migrations_postgresql_status_query() {

let res = results.unwrap();
let public_schema_info = res.get_postgres_rows();
let first_result = public_schema_info.get(0).unwrap();
let first_result = public_schema_info.first().unwrap();

assert_eq!(first_result.columns().get(0).unwrap().name(), "table_name");
assert_eq!(first_result.columns().first().unwrap().name(), "table_name");
assert_eq!(
first_result.columns().get(0).unwrap().type_().name(),
first_result.columns().first().unwrap().type_().name(),
"name"
);
assert_eq!(first_result.columns().get(0).unwrap().type_().oid(), 19);
assert_eq!(first_result.columns().first().unwrap().type_().oid(), 19);
assert_eq!(
first_result.columns().get(0).unwrap().type_().schema(),
first_result.columns().first().unwrap().type_().schema(),
"pg_catalog"
);
}

0 comments on commit 633ce4e

Please sign in to comment.