fix: clippy warnings
This commit is contained in:
parent
b11c07163f
commit
c8940bae1c
5 changed files with 8 additions and 8 deletions
|
@ -21,7 +21,7 @@ pub fn get_all_migrations(dir_path: &Path) -> MigraResult<migration::List> {
|
||||||
Err(e) if e.kind() == io::ErrorKind::NotFound => vec![],
|
Err(e) if e.kind() == io::ErrorKind::NotFound => vec![],
|
||||||
entries => entries?
|
entries => entries?
|
||||||
.filter_map(|res| res.ok().map(|e| e.path()))
|
.filter_map(|res| res.ok().map(|e| e.path()))
|
||||||
.filter(|path| is_migration_dir(&path))
|
.filter(|path| is_migration_dir(path))
|
||||||
.collect::<Vec<_>>(),
|
.collect::<Vec<_>>(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ impl List {
|
||||||
|
|
||||||
/// Push migration to list.
|
/// Push migration to list.
|
||||||
pub fn push(&mut self, migration: Migration) {
|
pub fn push(&mut self, migration: Migration) {
|
||||||
self.inner.push(migration)
|
self.inner.push(migration);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Push migration name to list.
|
/// Push migration name to list.
|
||||||
|
@ -120,7 +120,7 @@ impl List {
|
||||||
/// # assert_eq!(list, List::from(vec!["name"]));
|
/// # assert_eq!(list, List::from(vec!["name"]));
|
||||||
/// ```
|
/// ```
|
||||||
pub fn push_name(&mut self, name: &str) {
|
pub fn push_name(&mut self, name: &str) {
|
||||||
self.inner.push(Migration::new(name))
|
self.inner.push(Migration::new(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check if list contains specific migration.
|
/// Check if list contains specific migration.
|
||||||
|
|
|
@ -38,7 +38,7 @@ pub(crate) fn rollback_applied_migrations(
|
||||||
.try_for_each(|(migration_name, content)| {
|
.try_for_each(|(migration_name, content)| {
|
||||||
if all_migrations.contains_name(migration_name) {
|
if all_migrations.contains_name(migration_name) {
|
||||||
println!("downgrade {}...", migration_name);
|
println!("downgrade {}...", migration_name);
|
||||||
client.run_downgrade_migration(migration_name, &content)
|
client.run_downgrade_migration(migration_name, content)
|
||||||
} else {
|
} else {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ pub(crate) fn upgrade_pending_migrations(
|
||||||
.iter()
|
.iter()
|
||||||
.try_for_each(|(migration_name, content)| {
|
.try_for_each(|(migration_name, content)| {
|
||||||
println!("upgrade {}...", migration_name);
|
println!("upgrade {}...", migration_name);
|
||||||
client.run_upgrade_migration(migration_name, &content)
|
client.run_upgrade_migration(migration_name, content)
|
||||||
})
|
})
|
||||||
.map_err(From::from)
|
.map_err(From::from)
|
||||||
})?;
|
})?;
|
||||||
|
|
|
@ -138,7 +138,7 @@ impl DatabaseConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn connection_string(&self) -> MigraResult<String> {
|
pub fn connection_string(&self) -> MigraResult<String> {
|
||||||
self.connection.strip_prefix("$").map_or_else(
|
self.connection.strip_prefix('$').map_or_else(
|
||||||
|| Ok(self.connection.clone()),
|
|| Ok(self.connection.clone()),
|
||||||
|connection_env| {
|
|connection_env| {
|
||||||
env::var(connection_env)
|
env::var(connection_env)
|
||||||
|
@ -183,7 +183,7 @@ impl Default for MigrationsConfig {
|
||||||
|
|
||||||
impl MigrationsConfig {
|
impl MigrationsConfig {
|
||||||
pub fn directory(&self) -> String {
|
pub fn directory(&self) -> String {
|
||||||
self.directory.strip_prefix("$").map_or_else(
|
self.directory.strip_prefix('$').map_or_else(
|
||||||
|| self.directory.clone(),
|
|| self.directory.clone(),
|
||||||
|directory_env| {
|
|directory_env| {
|
||||||
env::var(directory_env).unwrap_or_else(|_| {
|
env::var(directory_env).unwrap_or_else(|_| {
|
||||||
|
@ -199,7 +199,7 @@ impl MigrationsConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn table_name(&self) -> String {
|
pub fn table_name(&self) -> String {
|
||||||
self.table_name.strip_prefix("$").map_or_else(
|
self.table_name.strip_prefix('$').map_or_else(
|
||||||
|| self.table_name.clone(),
|
|| self.table_name.clone(),
|
||||||
|table_name_env| {
|
|table_name_env| {
|
||||||
env::var(table_name_env).unwrap_or_else(|_| {
|
env::var(table_name_env).unwrap_or_else(|_| {
|
||||||
|
|
Reference in a new issue