Skip to content

Commit

Permalink
Avoid unwrap
Browse files Browse the repository at this point in the history
  • Loading branch information
turai committed Sep 11, 2023
1 parent c4da3f4 commit 7c0fbd0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/native/card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,9 @@ where
.zip(&mut tree.children)
.zip(layout.children())
.filter_map(|((child, state), layout)| {
let first_child = layout.children().next().unwrap();
child.as_widget_mut().overlay(state, first_child, renderer)
layout.children().next().map(|child_layout| {

Check failure on line 578 in src/native/card.rs

View workflow job for this annotation

GitHub Actions / all

called `map(<f>).unwrap_or(None)` on an `Option` value. This can be done more directly by calling `and_then(<f>)` instead
child.as_widget_mut().overlay(state, child_layout, renderer)
}).unwrap_or(None)
})
.collect::<Vec<_>>();

Expand Down

0 comments on commit 7c0fbd0

Please sign in to comment.