[pbs-devel] [PATCH proxmox-backup-qemu 3/6] clippy fix: shorten bool->i32 conversion

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon Dec 12 13:05:38 CET 2022


i32 implements From<bool> with the desired semantics, this still makes it
obvious that the conversion happens, although a plain `.into()` would also
work.

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 src/lib.rs | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/lib.rs b/src/lib.rs
index ee842ce..bdd162b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -417,13 +417,7 @@ pub extern "C" fn proxmox_backup_check_incremental(
 
     match tools::utf8_c_string_lossy(device_name) {
         None => 0,
-        Some(device_name) => {
-            if task.check_incremental(device_name, size) {
-                1
-            } else {
-                0
-            }
-        }
+        Some(device_name) => i32::from(task.check_incremental(device_name, size)),
     }
 }
 
-- 
2.30.2






More information about the pbs-devel mailing list