summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2023-01-07 07:57:23 +0000
committerLars Wirzenius <liw@liw.fi>2023-01-07 07:57:23 +0000
commit7ee3bec39f35f6a6259025b19b1b65134e091f5c (patch)
tree300a86249b5f41e32ef551b0da8dfd02cac75a0a
parent679026db532529c310e5b1a4799a957939320698 (diff)
parentb94fd44f231f565f5af9f200537cf8f2d219741c (diff)
downloadobnam2-7ee3bec39f35f6a6259025b19b1b65134e091f5c.tar.gz
Merge branch 'liw/chores' into 'main'
fix things found by clippy See merge request obnam/obnam!246
-rw-r--r--src/chunkstore.rs2
-rw-r--r--src/policy.rs6
2 files changed, 5 insertions, 3 deletions
diff --git a/src/chunkstore.rs b/src/chunkstore.rs
index 750b68b..4c8125c 100644
--- a/src/chunkstore.rs
+++ b/src/chunkstore.rs
@@ -157,7 +157,7 @@ impl RemoteStore {
let hits: HashMap<String, ChunkMeta> =
serde_json::from_slice(&body).map_err(StoreError::JsonParse)?;
- let ids = hits.iter().map(|(id, _)| ChunkId::recreate(id)).collect();
+ let ids = hits.keys().map(|id| ChunkId::recreate(id)).collect();
Ok(ids)
}
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();