summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2022-07-17 07:41:18 +0000
committerLars Wirzenius <liw@liw.fi>2022-07-17 07:41:18 +0000
commite913156c75a2852abfa065e2cca8b2ee40554b4f (patch)
treec4a7ffeef2e2d6497dad5b70c9f1add6b798479d
parent3bdeed513f9fc9ddc36cdabcf5db6642329dc596 (diff)
parenta4845a44d69ecc5f664f1d7536ddbc620b201fb2 (diff)
downloadobnam2-e913156c75a2852abfa065e2cca8b2ee40554b4f.tar.gz
Merge branch 'liw/chore' into 'main'
chore: make code more idiomatic, based on clippy warnings See merge request obnam/obnam!233
-rw-r--r--src/backup_run.rs4
-rw-r--r--src/cmd/backup.rs2
-rw-r--r--src/config.rs4
3 files changed, 4 insertions, 6 deletions
diff --git a/src/backup_run.rs b/src/backup_run.rs
index 2418871..516e172 100644
--- a/src/backup_run.rs
+++ b/src/backup_run.rs
@@ -166,9 +166,7 @@ impl<'a> BackupRun<'a> {
}
fn checksum_kind(&self) -> LabelChecksumKind {
- self.checksum_kind
- .or(Some(LabelChecksumKind::Sha256))
- .unwrap()
+ self.checksum_kind.unwrap_or(LabelChecksumKind::Sha256)
}
async fn fetch_previous_generation(
diff --git a/src/cmd/backup.rs b/src/cmd/backup.rs
index 60045cc..80dbb1f 100644
--- a/src/cmd/backup.rs
+++ b/src/cmd/backup.rs
@@ -42,7 +42,7 @@ impl Backup {
) -> Result<(), ObnamError> {
let runtime = SystemTime::now();
- let major = self.backup_version.or(Some(DEFAULT_SCHEMA_MAJOR)).unwrap();
+ let major = self.backup_version.unwrap_or(DEFAULT_SCHEMA_MAJOR);
let schema = schema_version(major)?;
let client = BackupClient::new(config)?;
diff --git a/src/config.rs b/src/config.rs
index a9be716..5774aad 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -62,11 +62,11 @@ impl ClientConfig {
let exclude_cache_tag_directories = tentative.exclude_cache_tag_directories.unwrap_or(true);
let config = Self {
- chunk_size: tentative.chunk_size.or(Some(DEFAULT_CHUNK_SIZE)).unwrap(),
+ chunk_size: tentative.chunk_size.unwrap_or(DEFAULT_CHUNK_SIZE),
filename: filename.to_path_buf(),
roots,
server_url: tentative.server_url,
- verify_tls_cert: tentative.verify_tls_cert.or(Some(false)).unwrap(),
+ verify_tls_cert: tentative.verify_tls_cert.unwrap_or(false),
log,
exclude_cache_tag_directories,
};