From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 42AD11FF15F for ; Mon, 2 Dec 2024 10:58:11 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 59BCE12E68; Mon, 2 Dec 2024 10:58:13 +0100 (CET) From: Maximiliano Sandoval To: pbs-devel@lists.proxmox.com Date: Mon, 2 Dec 2024 10:57:57 +0100 Message-Id: <20241202095808.128299-2-m.sandoval@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241202095808.128299-1-m.sandoval@proxmox.com> References: <20241202095808.128299-1-m.sandoval@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 1 AWL 0.043 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy FSL_BULK_SIG 0.001 Bulk signature with no Unsubscribe KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RAZOR2_CF_RANGE_51_100 1.886 Razor2 gives confidence level above 50% RAZOR2_CHECK 0.922 Listed in Razor2 (http://razor.sf.net/) RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_SBL_A 0.1 Contains URL's A record listed in the Spamhaus SBL blocklist [185.199.110.153, 185.199.108.153, 185.199.109.153, 185.199.111.153] Subject: [pbs-devel] [PATCH backup 02/13] use inspect_err when possible X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" Fixes the manual_inspect clippy lint: ``` warning: using `map_err` over `inspect_err` --> src/bin/proxmox_backup_debug/diff.rs:125:18 | 125 | .map_err(|err| { | ^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_inspect = note: `#[warn(clippy::manual_inspect)]` on by default help: try | 125 ~ .inspect_err(|err| { 126 ~ log::error!("{}", format_key_source(&key.source, "encryption")); | ``` Signed-off-by: Maximiliano Sandoval --- proxmox-backup-client/src/catalog.rs | 6 ++---- proxmox-backup-client/src/main.rs | 3 +-- proxmox-file-restore/src/main.rs | 6 ++---- src/bin/proxmox_backup_debug/diff.rs | 3 +-- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/proxmox-backup-client/src/catalog.rs b/proxmox-backup-client/src/catalog.rs index 7173c8efc..473214c35 100644 --- a/proxmox-backup-client/src/catalog.rs +++ b/proxmox-backup-client/src/catalog.rs @@ -65,9 +65,8 @@ async fn dump_catalog(param: Value) -> Result { None => None, Some(key) => { let (key, _created, _fingerprint) = decrypt_key(&key.key, &get_encryption_key_password) - .map_err(|err| { + .inspect_err(|_err| { log::error!("{}", format_key_source(&key.source, "encryption")); - err })?; let crypt_config = CryptConfig::new(key)?; Some(Arc::new(crypt_config)) @@ -204,9 +203,8 @@ async fn catalog_shell(param: Value) -> Result<(), Error> { None => None, Some(key) => { let (key, _created, _fingerprint) = decrypt_key(&key.key, &get_encryption_key_password) - .map_err(|err| { + .inspect_err(|_err| { log::error!("{}", format_key_source(&key.source, "encryption")); - err })?; let crypt_config = CryptConfig::new(key)?; Some(Arc::new(crypt_config)) diff --git a/proxmox-backup-client/src/main.rs b/proxmox-backup-client/src/main.rs index 580feb626..c9be952ad 100644 --- a/proxmox-backup-client/src/main.rs +++ b/proxmox-backup-client/src/main.rs @@ -1543,9 +1543,8 @@ async fn restore( None => None, Some(ref key) => { let (key, _, _) = - decrypt_key(&key.key, &get_encryption_key_password).map_err(|err| { + decrypt_key(&key.key, &get_encryption_key_password).inspect_err(|_err| { log::error!("{}", format_key_source(&key.source, "encryption")); - err })?; Some(Arc::new(CryptConfig::new(key)?)) } diff --git a/proxmox-file-restore/src/main.rs b/proxmox-file-restore/src/main.rs index 0a60d69f6..bbfc6eb4e 100644 --- a/proxmox-file-restore/src/main.rs +++ b/proxmox-file-restore/src/main.rs @@ -291,9 +291,8 @@ async fn list( None => None, Some(ref key) => { let (key, _, _) = - decrypt_key(&key.key, &get_encryption_key_password).map_err(|err| { + decrypt_key(&key.key, &get_encryption_key_password).inspect_err(|_err| { log::error!("{}", format_key_source(&key.source, "encryption")); - err })?; Some(Arc::new(CryptConfig::new(key)?)) } @@ -455,9 +454,8 @@ async fn extract( None => None, Some(ref key) => { let (key, _, _) = - decrypt_key(&key.key, &get_encryption_key_password).map_err(|err| { + decrypt_key(&key.key, &get_encryption_key_password).inspect_err(|_err| { log::error!("{}", format_key_source(&key.source, "encryption")); - err })?; Some(Arc::new(CryptConfig::new(key)?)) } diff --git a/src/bin/proxmox_backup_debug/diff.rs b/src/bin/proxmox_backup_debug/diff.rs index dcd351d93..02389d0e5 100644 --- a/src/bin/proxmox_backup_debug/diff.rs +++ b/src/bin/proxmox_backup_debug/diff.rs @@ -122,9 +122,8 @@ async fn diff_archive_cmd( None => None, Some(key) => { let (key, _created, _fingerprint) = decrypt_key(&key.key, &get_encryption_key_password) - .map_err(|err| { + .inspect_err(|_err| { log::error!("{}", format_key_source(&key.source, "encryption")); - err })?; let crypt_config = CryptConfig::new(key)?; Some(Arc::new(crypt_config)) -- 2.39.5 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel