Skip to content

Commit a67bb1b

Browse files
committed
fix: sqlx-cli/tests/add.rs
1 parent 1fba1e0 commit a67bb1b

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sqlx-cli/tests/add.rs

+7-9
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,21 @@ impl Index<usize> for AddMigrationsResult {
8181
}
8282
}
8383

84-
struct AddMigrations<'a> {
84+
struct AddMigrations {
8585
tempdir: TempDir,
86-
config: Option<&'a str>,
86+
config_arg: Option<String>,
8787
}
8888

89-
impl<'a> AddMigrations<'a> {
89+
impl AddMigrations {
9090
fn new() -> anyhow::Result<Self> {
9191
anyhow::Ok(Self {
9292
tempdir: TempDir::new()?,
93-
config: None,
93+
config_arg: None,
9494
})
9595
}
9696

97-
fn with_config(mut self, config: &'a str) -> Self {
98-
self.config = Some(config);
97+
fn with_config(mut self, path: &str) -> Self {
98+
self.config_arg = Some(format!("--config={path}"));
9999
self
100100
}
101101

@@ -112,9 +112,7 @@ impl<'a> AddMigrations<'a> {
112112
.args(
113113
[
114114
vec!["sqlx", "migrate", "add", description],
115-
self.config
116-
.map(|path| vec!["--config", path])
117-
.unwrap_or_default(),
115+
self.config_arg.as_deref().map_or(vec![], |arg| vec![arg]),
118116
match revesible {
119117
true => vec!["-r"],
120118
false => vec![],

0 commit comments

Comments
 (0)