summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexander Batischev <eual.jp@gmail.com>2021-07-21 22:06:49 +0300
committerAlexander Batischev <eual.jp@gmail.com>2021-07-21 22:25:50 +0300
commit4dfba7091c1499917839f311c50b5032c0b561e0 (patch)
tree10da24d1c53a15431912d537e95ce065b09faa28 /src
parent969ec42e788bf0eb8be8319b3779da00a8bf1c9a (diff)
downloadobnam2-4dfba7091c1499917839f311c50b5032c0b561e0.tar.gz
Replace FsIterResult with plain Result
Diffstat (limited to 'src')
-rw-r--r--src/backup_run.rs4
-rw-r--r--src/fsiter.rs10
2 files changed, 6 insertions, 8 deletions
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<FilesystemEntry>,
+ entry: Result<FilesystemEntry, FsIterError>,
old: &LocalGeneration,
) -> Result<FsEntryBackupOutcome, BackupError> {
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<T> = Result<T, FsIterError>;
-
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<FilesystemEntry>;
+ type Item = Result<FilesystemEntry, FsIterError>;
fn next(&mut self) -> Option<Self::Item> {
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<FsIterResult<FilesystemEntry>>,
+ cachedir_tag: Option<Result<FilesystemEntry, FsIterError>>,
}
impl SkipCachedirs {
@@ -102,7 +100,7 @@ impl SkipCachedirs {
}
impl Iterator for SkipCachedirs {
- type Item = FsIterResult<FilesystemEntry>;
+ type Item = Result<FilesystemEntry, FsIterError>;
fn next(&mut self) -> Option<Self::Item> {
self.cachedir_tag.take().or_else(|| {
@@ -120,7 +118,7 @@ impl Iterator for SkipCachedirs {
}
}
-fn new_entry(path: &Path) -> FsIterResult<FilesystemEntry> {
+fn new_entry(path: &Path) -> Result<FilesystemEntry, FsIterError> {
let meta = std::fs::symlink_metadata(path);
debug!("metadata for {:?}: {:?}", path, meta);
let meta = match meta {