From acddd3f09aae0628d5d02416040527ce3af45bc4 Mon Sep 17 00:00:00 2001 From: Maximiliano Sandoval Date: Mon, 2 Dec 2024 10:58:06 +0100 Subject: [PATCH] restore_daemon: use map_while instead of filter_map(Result::ok) Fixes the lines_filter_map_ok clippy lint: ``` warning: `filter_map()` will run forever if the iterator repeatedly produces an `Err` --> proxmox-restore-daemon/src/proxmox_restore_daemon/disk.rs:195:14 | 195 | .filter_map(Result::ok) | ^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `map_while(Result::ok)` | note: this expression returning a `std::io::Lines` may produce an infinite number of `Err` in case of a read error --> proxmox-restore-daemon/src/proxmox_restore_daemon/disk.rs:193:18 | 193 | for f in BufReader::new(File::open("/proc/filesystems")?) | __________________^ 194 | | .lines() | |____________________^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#lines_filter_map_ok = note: `#[warn(clippy::lines_filter_map_ok)]` on by default ``` Signed-off-by: Maximiliano Sandoval --- proxmox-restore-daemon/src/proxmox_restore_daemon/disk.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxmox-restore-daemon/src/proxmox_restore_daemon/disk.rs b/proxmox-restore-daemon/src/proxmox_restore_daemon/disk.rs index f60dbbfa..50fbf315 100644 --- a/proxmox-restore-daemon/src/proxmox_restore_daemon/disk.rs +++ b/proxmox-restore-daemon/src/proxmox_restore_daemon/disk.rs @@ -192,7 +192,7 @@ impl Filesystems { let mut supported_fs = Vec::new(); for f in BufReader::new(File::open("/proc/filesystems")?) .lines() - .filter_map(Result::ok) + .map_while(Result::ok) { // ZFS is treated specially, don't attempt to do a regular mount with it let f = f.trim();