summaryrefslogtreecommitdiff
path: root/src/policy.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/policy.rs')
-rw-r--r--src/policy.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/policy.rs b/src/policy.rs
index bb98a48..8cdbd76 100644
--- a/src/policy.rs
+++ b/src/policy.rs
@@ -20,19 +20,21 @@ pub struct BackupPolicy {
old_if_changed: bool,
}
-impl BackupPolicy {
+impl Default for BackupPolicy {
/// Create a default policy.
- pub fn default() -> Self {
+ fn default() -> Self {
Self {
new: true,
old_if_changed: true,
}
}
+}
+impl BackupPolicy {
/// Does a given file need to be backed up?
pub fn needs_backup(&self, old: &LocalGeneration, new_entry: &FilesystemEntry) -> Reason {
let new_name = new_entry.pathbuf();
- let reason = match old.get_file(&new_name) {
+ match old.get_file(&new_name) {
Ok(None) => {
if self.new {
Reason::IsNew
@@ -58,8 +60,7 @@ impl BackupPolicy {
);
Reason::GenerationLookupError
}
- };
- reason
+ }
}
}