Skip to content

Commit

Permalink
clippy fixes for the add command
Browse files Browse the repository at this point in the history
  • Loading branch information
imor committed Jan 13, 2025
1 parent 7dc93a0 commit a64b0cc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
13 changes: 5 additions & 8 deletions cli/src/commands/add.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{collections::HashSet, path::PathBuf};
use std::{collections::HashSet, path::Path};

use sqlx::{types::chrono::Utc, PgConnection};
use tokio::fs;
Expand All @@ -10,7 +10,7 @@ use crate::{

pub async fn add(
payload: &Payload,
output_path: &PathBuf,
output_path: &Path,
mut conn: PgConnection,
) -> anyhow::Result<()> {
let existing_versions = extension_versions(&mut conn, &payload.metadata.extension_name).await?;
Expand All @@ -35,7 +35,7 @@ pub async fn add(

if let Some(comment) = &payload.metadata.comment {
migration_content.push_str("-- Comment:");
migration_content.push_str(&comment);
migration_content.push_str(comment);
migration_content.push('\n');
}

Expand Down Expand Up @@ -86,7 +86,7 @@ pub async fn add(
migration_content.push_str("', '");
migration_content.push_str(&install_file.version);
migration_content.push_str("', $COMMENT$");
migration_content.push_str(&payload.metadata.comment.as_deref().unwrap_or(""));
migration_content.push_str(payload.metadata.comment.as_deref().unwrap_or(""));
migration_content.push_str("$COMMENT$, $SQL$");
migration_content.push_str(&install_file.body);
migration_content.push_str("$SQL$, ARRAY[");
Expand All @@ -100,10 +100,7 @@ pub async fn add(
}

let existing_update_paths =
match update_paths(&mut conn, &payload.metadata.extension_name).await {
Ok(paths) => paths,
Err(_) => HashSet::new(),
};
(update_paths(&mut conn, &payload.metadata.extension_name).await).unwrap_or_default();

for upgrade_file in &payload.upgrade_files {
let update_path = UpdatePath {
Expand Down
2 changes: 1 addition & 1 deletion cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ async fn main() -> anyhow::Result<()> {
let payload = models::Payload::from_path(extension_dir)?;
let conn = util::get_connection(connection).await?;

commands::add::add(&payload, &output_path, conn).await?;
commands::add::add(&payload, output_path, conn).await?;

Ok(())
}
Expand Down

0 comments on commit a64b0cc

Please sign in to comment.