Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 2 additions & 4 deletions refinery/tests/mysql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ mod mysql {
let mut conn = pool.get_conn().unwrap();
embedded::migrations::runner().run(&mut conn).unwrap();
for row in format!(
"SELECT table_name FROM information_schema.tables WHERE table_name='{}'",
DEFAULT_TABLE_NAME
"SELECT table_name FROM information_schema.tables WHERE table_name='{DEFAULT_TABLE_NAME}'",
)
.run(conn)
.unwrap()
Expand All @@ -150,8 +149,7 @@ mod mysql {
.unwrap();

for row in format!(
"SELECT table_name FROM information_schema.tables WHERE table_name='{}'",
DEFAULT_TABLE_NAME
"SELECT table_name FROM information_schema.tables WHERE table_name='{DEFAULT_TABLE_NAME}'",
)
.run(conn)
.unwrap()
Expand Down
6 changes: 2 additions & 4 deletions refinery/tests/mysql_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ mod mysql_async {
.unwrap();

conn.query(format!(
"SELECT table_name FROM information_schema.tables WHERE table_name='{}'",
DEFAULT_TABLE_NAME
"SELECT table_name FROM information_schema.tables WHERE table_name='{DEFAULT_TABLE_NAME}'",
))
.await
.unwrap()
Expand All @@ -123,8 +122,7 @@ mod mysql_async {

let result = conn
.query(format!(
"SELECT table_name FROM information_schema.tables WHERE table_name='{}'",
DEFAULT_TABLE_NAME
"SELECT table_name FROM information_schema.tables WHERE table_name='{DEFAULT_TABLE_NAME}'",
))
.await
.unwrap();
Expand Down
10 changes: 4 additions & 6 deletions refinery/tests/postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ mod postgres {
for row in &client
.query(
&format!(
"SELECT table_name FROM information_schema.tables WHERE table_name='{}'",
DEFAULT_TABLE_NAME
"SELECT table_name FROM information_schema.tables WHERE table_name='{DEFAULT_TABLE_NAME}'",
),
&[],
)
Expand All @@ -156,8 +155,7 @@ mod postgres {
for row in &client
.query(
&format!(
"SELECT table_name FROM information_schema.tables WHERE table_name='{}'",
DEFAULT_TABLE_NAME
"SELECT table_name FROM information_schema.tables WHERE table_name='{DEFAULT_TABLE_NAME}'",
),
&[],
)
Expand Down Expand Up @@ -295,7 +293,7 @@ mod postgres {
let result = broken::migrations::runner().run(&mut client);

assert!(result.is_err());
println!("CURRENT: {:?}", result);
println!("CURRENT: {result:?}");

let current = client
.get_last_applied_migration(DEFAULT_TABLE_NAME)
Expand Down Expand Up @@ -341,7 +339,7 @@ mod postgres {
.run(&mut client);

assert!(result.is_err());
println!("CURRENT: {:?}", result);
println!("CURRENT: {result:?}");

let query = &client
.query("SELECT version FROM refinery_schema_history", &[])
Expand Down
9 changes: 3 additions & 6 deletions refinery/tests/rusqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ mod rusqlite {
let table_name: String = conn
.query_row(
&format!(
"SELECT name FROM sqlite_master WHERE type='table' AND name='{}'",
DEFAULT_TABLE_NAME
"SELECT name FROM sqlite_master WHERE type='table' AND name='{DEFAULT_TABLE_NAME}'",
),
[],
|row| row.get(0),
Expand All @@ -161,8 +160,7 @@ mod rusqlite {
let table_name: String = conn
.query_row(
&format!(
"SELECT name FROM sqlite_master WHERE type='table' AND name='{}'",
DEFAULT_TABLE_NAME
"SELECT name FROM sqlite_master WHERE type='table' AND name='{DEFAULT_TABLE_NAME}'",
),
[],
|row| row.get(0),
Expand All @@ -181,8 +179,7 @@ mod rusqlite {
let table_name: String = conn
.query_row(
&format!(
"SELECT name FROM sqlite_master WHERE type='table' AND name='{}'",
DEFAULT_TABLE_NAME
"SELECT name FROM sqlite_master WHERE type='table' AND name='{DEFAULT_TABLE_NAME}'",
),
[],
|row| row.get(0),
Expand Down
6 changes: 2 additions & 4 deletions refinery/tests/tiberius.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,7 @@ mod tiberius {

let row = client
.simple_query(&format!(
"SELECT table_name FROM information_schema.tables WHERE table_name='{}'",
DEFAULT_TABLE_NAME
"SELECT table_name FROM information_schema.tables WHERE table_name='{DEFAULT_TABLE_NAME}'",
))
.await
.unwrap()
Expand Down Expand Up @@ -334,8 +333,7 @@ mod tiberius {

let row = client
.simple_query(&format!(
"SELECT table_name FROM information_schema.tables WHERE table_name='{}'",
DEFAULT_TABLE_NAME
"SELECT table_name FROM information_schema.tables WHERE table_name='{DEFAULT_TABLE_NAME}'",
))
.await
.unwrap()
Expand Down
6 changes: 2 additions & 4 deletions refinery/tests/tokio_postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ mod tokio_postgres {
let rows = client
.query(
&format!(
"SELECT table_name FROM information_schema.tables WHERE table_name='{}'",
DEFAULT_TABLE_NAME
"SELECT table_name FROM information_schema.tables WHERE table_name='{DEFAULT_TABLE_NAME}'",
),
&[],
)
Expand Down Expand Up @@ -193,8 +192,7 @@ mod tokio_postgres {
let rows = client
.query(
&format!(
"SELECT table_name FROM information_schema.tables WHERE table_name='{}'",
DEFAULT_TABLE_NAME
"SELECT table_name FROM information_schema.tables WHERE table_name='{DEFAULT_TABLE_NAME}'",
),
&[],
)
Expand Down
12 changes: 6 additions & 6 deletions refinery_core/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl Config {
pub fn from_env_var(name: &str) -> Result<Config, Error> {
let value = std::env::var(name).map_err(|_| {
Error::new(
Kind::ConfigError(format!("Couldn't find {} environment variable", name)),
Kind::ConfigError(format!("Couldn't find {name} environment variable")),
None,
)
})?;
Expand All @@ -64,14 +64,14 @@ impl Config {
pub fn from_file_location<T: AsRef<std::path::Path>>(location: T) -> Result<Config, Error> {
let file = std::fs::read_to_string(&location).map_err(|err| {
Error::new(
Kind::ConfigError(format!("could not open config file, {}", err)),
Kind::ConfigError(format!("could not open config file, {err}")),
None,
)
})?;

let mut config: Config = toml::from_str(&file).map_err(|err| {
Error::new(
Kind::ConfigError(format!("could not parse config file, {}", err)),
Kind::ConfigError(format!("could not parse config file, {err}")),
None,
)
})?;
Expand Down Expand Up @@ -99,7 +99,7 @@ impl Config {

let config_db_path = config_db_path.canonicalize().map_err(|err| {
Error::new(
Kind::ConfigError(format!("invalid sqlite db path, {}", err)),
Kind::ConfigError(format!("invalid sqlite db path, {err}")),
None,
)
})?;
Expand Down Expand Up @@ -293,7 +293,7 @@ impl FromStr for Config {
fn from_str(url_str: &str) -> Result<Config, Self::Err> {
let url = Url::parse(url_str).map_err(|_| {
Error::new(
Kind::ConfigError(format!("Couldn't parse the string '{}' as a URL", url_str)),
Kind::ConfigError(format!("Couldn't parse the string '{url_str}' as a URL")),
None,
)
})?;
Expand Down Expand Up @@ -365,7 +365,7 @@ cfg_if::cfg_if! {

if let Some(port) = &config.main.db_port {
let port = port.parse().map_err(|_| Error::new(
Kind::ConfigError(format!("Couldn't parse value {} as mssql port", port)),
Kind::ConfigError(format!("Couldn't parse value {port} as mssql port")),
None,
))?;
tconfig.port(port);
Expand Down
7 changes: 3 additions & 4 deletions refinery_core/src/drivers/tiberius.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,14 @@ where
{
fn assert_migrations_table_query(migration_table_name: &str) -> String {
format!(
"IF NOT EXISTS(SELECT 1 FROM sys.Tables WHERE Name = N'{table_name}')
"IF NOT EXISTS(SELECT 1 FROM sys.Tables WHERE Name = N'{migration_table_name}')
BEGIN
CREATE TABLE {table_name}(
CREATE TABLE {migration_table_name}(
version INT PRIMARY KEY,
name VARCHAR(255),
applied_on VARCHAR(255),
checksum VARCHAR(255));
END",
table_name = migration_table_name
END"
)
}
}
4 changes: 2 additions & 2 deletions refinery_core/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl fmt::Display for Type {
Type::Versioned => "V",
Type::Unversioned => "U",
};
write!(f, "{}", version_type)
write!(f, "{version_type}")
}
}

Expand All @@ -35,7 +35,7 @@ impl fmt::Debug for Type {
Type::Versioned => "Versioned",
Type::Unversioned => "Unversioned",
};
write!(f, "{}", version_type)
write!(f, "{version_type}")
}
}

Expand Down
6 changes: 3 additions & 3 deletions refinery_core/src/traits/async.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::error::WrapMigrationError;
use crate::traits::{
insert_migration_query, verify_migrations, ASSERT_MIGRATIONS_TABLE_QUERY,
GET_APPLIED_MIGRATIONS_QUERY, GET_LAST_APPLIED_MIGRATION_QUERY,
insert_migration_query, verify_migrations, GET_APPLIED_MIGRATIONS_QUERY,
GET_LAST_APPLIED_MIGRATION_QUERY,
};
use crate::{Error, Migration, Report, Target};

Expand Down Expand Up @@ -49,7 +49,7 @@ async fn migrate<T: AsyncTransaction>(
])
.await
.migration_err(
&format!("error applying migration {}", migration),
&format!("error applying migration {migration}"),
Some(&applied_migrations),
)?;
applied_migrations.push(migration);
Expand Down
4 changes: 2 additions & 2 deletions refinery_core/src/traits/sync.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::error::WrapMigrationError;
use crate::traits::{
insert_migration_query, verify_migrations, ASSERT_MIGRATIONS_TABLE_QUERY,
GET_APPLIED_MIGRATIONS_QUERY, GET_LAST_APPLIED_MIGRATION_QUERY,
insert_migration_query, verify_migrations, GET_APPLIED_MIGRATIONS_QUERY,
GET_LAST_APPLIED_MIGRATION_QUERY,
};
use crate::{Error, Migration, Report, Target};

Expand Down
Loading