Use match statement in Content::overlay

... to improve readability a bit.
This commit is contained in:
Héctor Ramón Jiménez 2021-06-22 11:29:06 +02:00
parent 27b42ca6b6
commit 15c17a7250
No known key found for this signature in database
GPG Key ID: 44B88EB52AB1EE8D

View File

@ -195,13 +195,12 @@ where
) -> Option<overlay::Element<'_, Message, Renderer>> {
if let Some(title_bar) = self.title_bar.as_mut() {
let mut children = layout.children();
let title_bar_layout = children.next().unwrap();
let title_bar_layout = children.next()?;
if let Some(overlay) = title_bar.overlay(title_bar_layout) {
return Some(overlay);
match title_bar.overlay(title_bar_layout) {
Some(overlay) => Some(overlay),
None => self.body.overlay(children.next()?),
}
self.body.overlay(children.next()?)
} else {
self.body.overlay(layout)
}