summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2023-01-07 09:45:11 +0200
committerLars Wirzenius <liw@liw.fi>2023-01-07 09:45:11 +0200
commitb94fd44f231f565f5af9f200537cf8f2d219741c (patch)
tree300a86249b5f41e32ef551b0da8dfd02cac75a0a
parent3b4b8c537f472c7ec8d90eb79d70fce11a13669c (diff)
downloadobnam2-b94fd44f231f565f5af9f200537cf8f2d219741c.tar.gz
refactor: implement Default trait, instead just a function default
Found by clippy. Sponsored-by: author
-rw-r--r--src/policy.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/policy.rs b/src/policy.rs
index b3ba24c..8cdbd76 100644
--- a/src/policy.rs
+++ b/src/policy.rs
@@ -20,15 +20,17 @@ 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();