From 4dfba7091c1499917839f311c50b5032c0b561e0 Mon Sep 17 00:00:00 2001 From: Alexander Batischev Date: Wed, 21 Jul 2021 22:06:49 +0300 Subject: Replace FsIterResult with plain Result --- src/backup_run.rs | 4 ++-- src/fsiter.rs | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/backup_run.rs b/src/backup_run.rs index 6c3a4f2..3c03ec3 100644 --- a/src/backup_run.rs +++ b/src/backup_run.rs @@ -5,7 +5,7 @@ use crate::client::{BackupClient, ClientError}; use crate::config::ClientConfig; use crate::error::ObnamError; use crate::fsentry::FilesystemEntry; -use crate::fsiter::{FsIterError, FsIterResult, FsIterator}; +use crate::fsiter::{FsIterError, FsIterator}; use crate::generation::{LocalGeneration, LocalGenerationError, NascentError, NascentGeneration}; use crate::policy::BackupPolicy; use log::{info, warn}; @@ -118,7 +118,7 @@ impl<'a> BackupRun<'a> { pub fn backup( &self, - entry: FsIterResult, + entry: Result, old: &LocalGeneration, ) -> Result { match entry { diff --git a/src/fsiter.rs b/src/fsiter.rs index 56630fa..aea9078 100644 --- a/src/fsiter.rs +++ b/src/fsiter.rs @@ -20,8 +20,6 @@ pub enum FsIterError { FsEntryError(#[from] FsEntryError), } -pub type FsIterResult = Result; - impl FsIterator { pub fn new(root: &Path, exclude_cache_tag_directories: bool) -> Self { Self { @@ -34,7 +32,7 @@ impl FsIterator { } impl Iterator for FsIterator { - type Item = FsIterResult; + type Item = Result; fn next(&mut self) -> Option { self.iter.next() } @@ -47,7 +45,7 @@ struct SkipCachedirs { exclude_cache_tag_directories: bool, // This is the last tag we've found. `next()` will yield it before asking `iter` for more // entries. - cachedir_tag: Option>, + cachedir_tag: Option>, } impl SkipCachedirs { @@ -102,7 +100,7 @@ impl SkipCachedirs { } impl Iterator for SkipCachedirs { - type Item = FsIterResult; + type Item = Result; fn next(&mut self) -> Option { self.cachedir_tag.take().or_else(|| { @@ -120,7 +118,7 @@ impl Iterator for SkipCachedirs { } } -fn new_entry(path: &Path) -> FsIterResult { +fn new_entry(path: &Path) -> Result { let meta = std::fs::symlink_metadata(path); debug!("metadata for {:?}: {:?}", path, meta); let meta = match meta { -- cgit v1.2.1