From b7a12520d28f255e480178afd710b485fdbd6c92 Mon Sep 17 00:00:00 2001 From: Dongsu Park Date: Mon, 13 Jan 2025 17:22:02 +0100 Subject: [PATCH] libazureinit: fix clippy warning for Rust 1.84 Starting from Rust 1.84, clippy gives warning like below: ``` warning: this `map_or` is redundant --> libazureinit/src/config.rs:345:21 | 345 | path.extension().map_or(false, |ext| ext == "toml") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use is_some_and instead: `path.extension().is_some_and(|ext| ext == "toml")` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or = note: `#[warn(clippy::unnecessary_map_or)]` on by default ``` Fix that by using `is_some_and`. See also https://github.com/rust-lang/rust-clippy/blob/master/CHANGELOG.md#rust-184, https://github.com/rust-lang/rust-clippy/pull/11796. --- libazureinit/src/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libazureinit/src/config.rs b/libazureinit/src/config.rs index b5edef6a..d7a0daba 100644 --- a/libazureinit/src/config.rs +++ b/libazureinit/src/config.rs @@ -342,7 +342,7 @@ impl Config { .filter_map(Result::ok) .map(|entry| entry.path()) .filter(|path| { - path.extension().map_or(false, |ext| ext == "toml") + path.extension().is_some_and(|ext| ext == "toml") }) .collect();