[pbs-devel] [PATCH proxmox-backup 11/12] config/tape_encryption_keys: clippy fixes
Dominik Csapak
d.csapak at proxmox.com
Tue Apr 6 08:27:46 CEST 2021
fixes:
* combine if branches
* unnecessary clone
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
src/config/tape_encryption_keys.rs | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/config/tape_encryption_keys.rs b/src/config/tape_encryption_keys.rs
index 42c3184d..db3c9fbf 100644
--- a/src/config/tape_encryption_keys.rs
+++ b/src/config/tape_encryption_keys.rs
@@ -201,17 +201,15 @@ pub fn insert_key(key: [u8;32], key_config: KeyConfig, force: bool) -> Result<()
None => bail!("missing encryption key fingerprint - internal error"),
};
- if !force {
- if config_map.get(&fingerprint).is_some() {
- bail!("encryption key '{}' already exists.", fingerprint);
- }
+ if !force && config_map.get(&fingerprint).is_some() {
+ bail!("encryption key '{}' already exists.", fingerprint);
}
let item = EncryptionKeyInfo::new(key, fingerprint.clone());
key_map.insert(fingerprint.clone(), item);
save_keys(key_map)?;
- config_map.insert(fingerprint.clone(), key_config);
+ config_map.insert(fingerprint, key_config);
save_key_configs(config_map)?;
Ok(())
--
2.20.1
More information about the pbs-devel
mailing list