diff --git a/refinery/tests/mysql.rs b/refinery/tests/mysql.rs index a9c487b..de2a25d 100644 --- a/refinery/tests/mysql.rs +++ b/refinery/tests/mysql.rs @@ -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() @@ -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() diff --git a/refinery/tests/mysql_async.rs b/refinery/tests/mysql_async.rs index a3892ae..a9069b7 100644 --- a/refinery/tests/mysql_async.rs +++ b/refinery/tests/mysql_async.rs @@ -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() @@ -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(); diff --git a/refinery/tests/postgres.rs b/refinery/tests/postgres.rs index c4aa630..0079369 100644 --- a/refinery/tests/postgres.rs +++ b/refinery/tests/postgres.rs @@ -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}'", ), &[], ) @@ -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}'", ), &[], ) @@ -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) @@ -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", &[]) diff --git a/refinery/tests/rusqlite.rs b/refinery/tests/rusqlite.rs index 258af42..f7807d6 100644 --- a/refinery/tests/rusqlite.rs +++ b/refinery/tests/rusqlite.rs @@ -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), @@ -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), @@ -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), diff --git a/refinery/tests/tiberius.rs b/refinery/tests/tiberius.rs index f634606..e6dcb8d 100644 --- a/refinery/tests/tiberius.rs +++ b/refinery/tests/tiberius.rs @@ -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() @@ -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() diff --git a/refinery/tests/tokio_postgres.rs b/refinery/tests/tokio_postgres.rs index e086ecc..304c85e 100644 --- a/refinery/tests/tokio_postgres.rs +++ b/refinery/tests/tokio_postgres.rs @@ -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}'", ), &[], ) @@ -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}'", ), &[], ) diff --git a/refinery_core/src/config.rs b/refinery_core/src/config.rs index 0d6319a..bbb3b1d 100644 --- a/refinery_core/src/config.rs +++ b/refinery_core/src/config.rs @@ -52,7 +52,7 @@ impl Config { pub fn from_env_var(name: &str) -> Result { 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, ) })?; @@ -64,14 +64,14 @@ impl Config { pub fn from_file_location>(location: T) -> Result { 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, ) })?; @@ -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, ) })?; @@ -293,7 +293,7 @@ impl FromStr for Config { fn from_str(url_str: &str) -> Result { 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, ) })?; @@ -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); diff --git a/refinery_core/src/drivers/tiberius.rs b/refinery_core/src/drivers/tiberius.rs index a30e031..4218ee7 100644 --- a/refinery_core/src/drivers/tiberius.rs +++ b/refinery_core/src/drivers/tiberius.rs @@ -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" ) } } diff --git a/refinery_core/src/runner.rs b/refinery_core/src/runner.rs index d6d93af..97921e8 100644 --- a/refinery_core/src/runner.rs +++ b/refinery_core/src/runner.rs @@ -25,7 +25,7 @@ impl fmt::Display for Type { Type::Versioned => "V", Type::Unversioned => "U", }; - write!(f, "{}", version_type) + write!(f, "{version_type}") } } @@ -35,7 +35,7 @@ impl fmt::Debug for Type { Type::Versioned => "Versioned", Type::Unversioned => "Unversioned", }; - write!(f, "{}", version_type) + write!(f, "{version_type}") } } diff --git a/refinery_core/src/traits/async.rs b/refinery_core/src/traits/async.rs index bd8f42a..8e42337 100644 --- a/refinery_core/src/traits/async.rs +++ b/refinery_core/src/traits/async.rs @@ -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}; @@ -49,7 +49,7 @@ async fn migrate( ]) .await .migration_err( - &format!("error applying migration {}", migration), + &format!("error applying migration {migration}"), Some(&applied_migrations), )?; applied_migrations.push(migration); diff --git a/refinery_core/src/traits/sync.rs b/refinery_core/src/traits/sync.rs index ff20879..0225f87 100644 --- a/refinery_core/src/traits/sync.rs +++ b/refinery_core/src/traits/sync.rs @@ -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};