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: Fixed Clippy warnings from issue #55 #56

Merged
merged 1 commit into from
Feb 25, 2024
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 canyon_connection/src/lib.rs
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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"
);
}
Loading