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

Address clippy warnings for Rust stable 1.84 #1168

Merged
merged 1 commit into from
Jan 10, 2025
Merged
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
16 changes: 5 additions & 11 deletions src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,7 @@ async fn has_id_column(
let result = db
.query_one(Statement::from_string(DatabaseBackend::Postgres, query))
.await?;
result.map_or(false, |row| {
row.try_get::<bool>("", "exists").unwrap_or(false)
})
result.is_some_and(|row| row.try_get::<bool>("", "exists").unwrap_or(false))
}
DatabaseBackend::Sqlite => {
let query = format!(
Expand All @@ -325,9 +323,7 @@ async fn has_id_column(
let result = db
.query_one(Statement::from_string(DatabaseBackend::Sqlite, query))
.await?;
result.map_or(false, |row| {
row.try_get::<i32>("", "count").unwrap_or(0) > 0
})
result.is_some_and(|row| row.try_get::<i32>("", "count").unwrap_or(0) > 0)
}
DatabaseBackend::MySql => {
return Err(Error::Message(
Expand Down Expand Up @@ -358,19 +354,17 @@ async fn is_auto_increment(
let result = db
.query_one(Statement::from_string(DatabaseBackend::Postgres, query))
.await?;
result.map_or(false, |row| {
row.try_get::<bool>("", "is_serial").unwrap_or(false)
})
result.is_some_and(|row| row.try_get::<bool>("", "is_serial").unwrap_or(false))
}
DatabaseBackend::Sqlite => {
let query =
format!("SELECT sql FROM sqlite_master WHERE type='table' AND name='{table_name}'");
let result = db
.query_one(Statement::from_string(DatabaseBackend::Sqlite, query))
.await?;
result.map_or(false, |row| {
result.is_some_and(|row| {
row.try_get::<String>("", "sql")
.map_or(false, |sql| sql.to_lowercase().contains("autoincrement"))
.is_ok_and(|sql| sql.to_lowercase().contains("autoincrement"))
})
}
DatabaseBackend::MySql => {
Expand Down
Loading