Archived
1
0
Fork 0

fix: clippy warnings

This commit is contained in:
Dmitriy Pleshevskiy 2021-08-23 10:18:03 +03:00
parent b11c07163f
commit c8940bae1c
5 changed files with 8 additions and 8 deletions

View file

@ -21,7 +21,7 @@ pub fn get_all_migrations(dir_path: &Path) -> MigraResult<migration::List> {
Err(e) if e.kind() == io::ErrorKind::NotFound => vec![],
entries => entries?
.filter_map(|res| res.ok().map(|e| e.path()))
.filter(|path| is_migration_dir(&path))
.filter(|path| is_migration_dir(path))
.collect::<Vec<_>>(),
};

View file

@ -98,7 +98,7 @@ impl List {
/// Push migration to list.
pub fn push(&mut self, migration: Migration) {
self.inner.push(migration)
self.inner.push(migration);
}
/// Push migration name to list.
@ -120,7 +120,7 @@ impl List {
/// # assert_eq!(list, List::from(vec!["name"]));
/// ```
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.

View file

@ -38,7 +38,7 @@ pub(crate) fn rollback_applied_migrations(
.try_for_each(|(migration_name, content)| {
if all_migrations.contains_name(migration_name) {
println!("downgrade {}...", migration_name);
client.run_downgrade_migration(migration_name, &content)
client.run_downgrade_migration(migration_name, content)
} else {
Ok(())
}

View file

@ -57,7 +57,7 @@ pub(crate) fn upgrade_pending_migrations(
.iter()
.try_for_each(|(migration_name, content)| {
println!("upgrade {}...", migration_name);
client.run_upgrade_migration(migration_name, &content)
client.run_upgrade_migration(migration_name, content)
})
.map_err(From::from)
})?;

View file

@ -138,7 +138,7 @@ impl DatabaseConfig {
}
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()),
|connection_env| {
env::var(connection_env)
@ -183,7 +183,7 @@ impl Default for MigrationsConfig {
impl MigrationsConfig {
pub fn directory(&self) -> String {
self.directory.strip_prefix("$").map_or_else(
self.directory.strip_prefix('$').map_or_else(
|| self.directory.clone(),
|directory_env| {
env::var(directory_env).unwrap_or_else(|_| {
@ -199,7 +199,7 @@ impl MigrationsConfig {
}
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(),
|table_name_env| {
env::var(table_name_env).unwrap_or_else(|_| {