From 507b297d3477ca83fd16ff01c1cf8d5844b86c0b Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Wed, 15 Jan 2025 11:05:24 +0900 Subject: [PATCH] Fix clippy::unnecessary_map_or warning ``` error: this `map_or` is redundant --> tf_rosrust/src/tf_buffer.rs:95:24 | 95 | if self | ________________________^ 96 | | .transform_data 97 | | .get(&TfGraphNode { 98 | | child: v.clone(), 99 | | parent: current_node.clone(), 100 | | }) 101 | | .map_or(false, |chain| chain.has_valid_transform(time)) | |_______________________________________________________________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or = note: `-D clippy::unnecessary-map-or` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unnecessary_map_or)]` help: use is_some_and instead | 95 ~ if self 96 + .transform_data 97 + .get(&TfGraphNode { 98 + child: v.clone(), 99 + parent: current_node.clone(), 100 + }).is_some_and(|chain| chain.has_valid_transform(time)) | ``` --- tf_r2r/src/tf_buffer.rs | 2 +- tf_rosrust/src/tf_buffer.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tf_r2r/src/tf_buffer.rs b/tf_r2r/src/tf_buffer.rs index 2609c683..510ab89b 100644 --- a/tf_r2r/src/tf_buffer.rs +++ b/tf_r2r/src/tf_buffer.rs @@ -99,7 +99,7 @@ impl TfBuffer { child: v.clone(), parent: current_node.clone(), }) - .map_or(false, |chain| chain.has_valid_transform(time)) + .is_some_and(|chain| chain.has_valid_transform(time)) { parents.insert(v.to_string(), current_node.clone()); frontier.push_front(v.to_string()); diff --git a/tf_rosrust/src/tf_buffer.rs b/tf_rosrust/src/tf_buffer.rs index 90737c64..62dd26cd 100644 --- a/tf_rosrust/src/tf_buffer.rs +++ b/tf_rosrust/src/tf_buffer.rs @@ -98,7 +98,7 @@ impl TfBuffer { child: v.clone(), parent: current_node.clone(), }) - .map_or(false, |chain| chain.has_valid_transform(time)) + .is_some_and(|chain| chain.has_valid_transform(time)) { parents.insert(v.to_string(), current_node.clone()); frontier.push_front(v.to_string());