Skip to content

Commit

Permalink
Fix clippy::unnecessary_map_or warning
Browse files Browse the repository at this point in the history
```
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))
    |
```
  • Loading branch information
taiki-e committed Jan 15, 2025
1 parent 36055d7 commit 507b297
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tf_r2r/src/tf_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion tf_rosrust/src/tf_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 507b297

Please sign in to comment.