Skip to content

Commit a64b0cc

Browse files
committed
clippy fixes for the add command
1 parent 7dc93a0 commit a64b0cc

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

cli/src/commands/add.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::{collections::HashSet, path::PathBuf};
1+
use std::{collections::HashSet, path::Path};
22

33
use sqlx::{types::chrono::Utc, PgConnection};
44
use tokio::fs;
@@ -10,7 +10,7 @@ use crate::{
1010

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

3636
if let Some(comment) = &payload.metadata.comment {
3737
migration_content.push_str("-- Comment:");
38-
migration_content.push_str(&comment);
38+
migration_content.push_str(comment);
3939
migration_content.push('\n');
4040
}
4141

@@ -86,7 +86,7 @@ pub async fn add(
8686
migration_content.push_str("', '");
8787
migration_content.push_str(&install_file.version);
8888
migration_content.push_str("', $COMMENT$");
89-
migration_content.push_str(&payload.metadata.comment.as_deref().unwrap_or(""));
89+
migration_content.push_str(payload.metadata.comment.as_deref().unwrap_or(""));
9090
migration_content.push_str("$COMMENT$, $SQL$");
9191
migration_content.push_str(&install_file.body);
9292
migration_content.push_str("$SQL$, ARRAY[");
@@ -100,10 +100,7 @@ pub async fn add(
100100
}
101101

102102
let existing_update_paths =
103-
match update_paths(&mut conn, &payload.metadata.extension_name).await {
104-
Ok(paths) => paths,
105-
Err(_) => HashSet::new(),
106-
};
103+
(update_paths(&mut conn, &payload.metadata.extension_name).await).unwrap_or_default();
107104

108105
for upgrade_file in &payload.upgrade_files {
109106
let update_path = UpdatePath {

cli/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ async fn main() -> anyhow::Result<()> {
166166
let payload = models::Payload::from_path(extension_dir)?;
167167
let conn = util::get_connection(connection).await?;
168168

169-
commands::add::add(&payload, &output_path, conn).await?;
169+
commands::add::add(&payload, output_path, conn).await?;
170170

171171
Ok(())
172172
}

0 commit comments

Comments
 (0)