From 8f2954e39c4277902c8f1c9b4360902da2e3f112 Mon Sep 17 00:00:00 2001 From: vil02 Date: Fri, 7 Jun 2024 07:05:45 +0200 Subject: [PATCH 1/2] style: resolve `map_unwrap_or` --- src/graph/astar.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/graph/astar.rs b/src/graph/astar.rs index 3c74fadf7a8..90e836f4ae4 100644 --- a/src/graph/astar.rs +++ b/src/graph/astar.rs @@ -62,8 +62,7 @@ pub fn astar + Zero>( let real_weight = real_weight + weight; if weights .get(&next) - .map(|&weight| real_weight < weight) - .unwrap_or(true) + .map_or(true, |&weight| real_weight < weight) { // current allows us to reach next with lower weight (or at all) // add next to the front From 932fe91b3bd6297f572245b0ae949f4059cf3ec4 Mon Sep 17 00:00:00 2001 From: vil02 Date: Fri, 7 Jun 2024 07:06:36 +0200 Subject: [PATCH 2/2] chore: add `map_unwrap_or` warning --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index a965e911137..8774423d0d6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,3 +22,4 @@ big-math = ["dep:num-bigint", "dep:num-traits"] [lints.clippy] uninlined_format_args = "warn" +map_unwrap_or = "warn"