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

refactor(cli): Remove needless borrow #190

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
10 changes: 5 additions & 5 deletions blueprint/cli/src/bin/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ enum Commands {
}

#[allow(missing_docs)]
async fn cli(mut ui: &mut UI<'_>, cli: Cli) -> Result<(), anyhow::Error> {
async fn cli(ui: &mut UI<'_>, cli: Cli) -> Result<(), anyhow::Error> {
let config: Result<Config, anyhow::Error> = load_config(&cli.env);
match config {
Ok(config) => {
Expand All @@ -91,7 +91,7 @@ async fn cli(mut ui: &mut UI<'_>, cli: Cli) -> Result<(), anyhow::Error> {
Commands::Migrate => {
ui.info(&format!("Migrating {} database…", &cli.env));
ui.indent();
let migrations = migrate(&mut ui, &config.database)
let migrations = migrate(ui, &config.database)
.await
.context("Could not migrate database!");
ui.outdent();
Expand All @@ -110,7 +110,7 @@ async fn cli(mut ui: &mut UI<'_>, cli: Cli) -> Result<(), anyhow::Error> {
Commands::Reset => {
ui.info(&format!("Resetting {} database…", &cli.env));
ui.indent();
let result = reset(&mut ui, &config.database)
let result = reset(ui, &config.database)
.await
.context("Could not reset the database!");
ui.outdent();
Expand All @@ -119,7 +119,7 @@ async fn cli(mut ui: &mut UI<'_>, cli: Cli) -> Result<(), anyhow::Error> {
Ok(())
}
Commands::Prepare => {
if let Err(e) = ensure_sqlx_cli_installed(&mut ui).await {
if let Err(e) = ensure_sqlx_cli_installed(ui).await {
return Err(e.context("Error ensuring sqlx-cli is installed!"));
}

Expand Down Expand Up @@ -346,7 +346,7 @@ async fn ensure_sqlx_cli_installed(ui: &mut UI<'_>) -> Result<(), anyhow::Error>

let current_version = installed_sqlx_cli_version(&cargo).await?;
if let Some(version) = &current_version {
if sqlx_version_req.matches(&version) {
if sqlx_version_req.matches(version) {
// sqlx-cli is already installed and of the correct version, nothing to do
return Ok(());
}
Expand Down