5
0
mirror of git://git.proxmox.com/git/proxmox-backup.git synced 2025-01-03 01:18:02 +03:00

use inspect_err when possible

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 <m.sandoval@proxmox.com>
This commit is contained in:
Maximiliano Sandoval 2024-12-02 10:57:57 +01:00 committed by Fabian Grünbichler
parent f36e8fea91
commit 81635877e2
4 changed files with 6 additions and 12 deletions

View File

@ -65,9 +65,8 @@ async fn dump_catalog(param: Value) -> Result<Value, 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))
@ -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))

View File

@ -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)?))
}

View File

@ -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)?))
}

View File

@ -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))