[pbs-devel] [PATCH proxmox-backup 06/12] backup: clippy fixes

Dominik Csapak d.csapak at proxmox.com
Tue Apr 6 08:27:41 CEST 2021


fixes:
* clone on copy type
* annotate 'wrong_self_convention'

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/backup/key_derivation.rs | 6 +++---
 src/backup/manifest.rs       | 1 +
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/backup/key_derivation.rs b/src/backup/key_derivation.rs
index 5b46a70c..ece04c4f 100644
--- a/src/backup/key_derivation.rs
+++ b/src/backup/key_derivation.rs
@@ -119,7 +119,7 @@ impl KeyConfig  {
     /// Creates a new, unencrypted key.
     pub fn without_password(raw_key: [u8; 32]) -> Result<Self, Error> {
         // always compute fingerprint
-        let crypt_config = CryptConfig::new(raw_key.clone())?;
+        let crypt_config = CryptConfig::new(raw_key)?;
         let fingerprint = Some(crypt_config.fingerprint());
 
         let created = proxmox::tools::time::epoch_i64();
@@ -186,7 +186,7 @@ impl KeyConfig  {
         let created = proxmox::tools::time::epoch_i64();
 
         // always compute fingerprint
-        let crypt_config = CryptConfig::new(raw_key.clone())?;
+        let crypt_config = CryptConfig::new(*raw_key)?;
         let fingerprint = Some(crypt_config.fingerprint());
 
         Ok(Self {
@@ -257,7 +257,7 @@ impl KeyConfig  {
         let mut result = [0u8; 32];
         result.copy_from_slice(&key);
 
-        let crypt_config = CryptConfig::new(result.clone())?;
+        let crypt_config = CryptConfig::new(result)?;
         let fingerprint = crypt_config.fingerprint();
         if let Some(ref stored_fingerprint) = self.fingerprint {
             if &fingerprint != stored_fingerprint {
diff --git a/src/backup/manifest.rs b/src/backup/manifest.rs
index 47f9cadc..f3a149bd 100644
--- a/src/backup/manifest.rs
+++ b/src/backup/manifest.rs
@@ -148,6 +148,7 @@ impl BackupManifest {
     }
 
     // Generate canonical json
+    #[allow(clippy::wrong_self_convention)]
     fn to_canonical_json(value: &Value) -> Result<Vec<u8>, Error> {
         crate::tools::json::to_canonical_json(value)
     }
-- 
2.20.1






More information about the pbs-devel mailing list