breadcrumbs: Use early return in set_active_pane_item
(#14691)
This PR refactors the `set_active_pane_item` implementation for `Breadcrumbs` to use an early return to avoid indenting the method body more than necessary. Release Notes: - N/A
This commit is contained in:
parent
a2424638f5
commit
457da7b27c
1 changed files with 24 additions and 23 deletions
|
@ -113,7 +113,11 @@ impl ToolbarItemView for Breadcrumbs {
|
||||||
) -> ToolbarItemLocation {
|
) -> ToolbarItemLocation {
|
||||||
cx.notify();
|
cx.notify();
|
||||||
self.active_item = None;
|
self.active_item = None;
|
||||||
if let Some(item) = active_pane_item {
|
|
||||||
|
let Some(item) = active_pane_item else {
|
||||||
|
return ToolbarItemLocation::Hidden;
|
||||||
|
};
|
||||||
|
|
||||||
let this = cx.view().downgrade();
|
let this = cx.view().downgrade();
|
||||||
self.subscription = Some(item.subscribe_to_item_events(
|
self.subscription = Some(item.subscribe_to_item_events(
|
||||||
cx,
|
cx,
|
||||||
|
@ -133,9 +137,6 @@ impl ToolbarItemView for Breadcrumbs {
|
||||||
));
|
));
|
||||||
self.active_item = Some(item.boxed_clone());
|
self.active_item = Some(item.boxed_clone());
|
||||||
item.breadcrumb_location(cx)
|
item.breadcrumb_location(cx)
|
||||||
} else {
|
|
||||||
ToolbarItemLocation::Hidden
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pane_focus_update(&mut self, pane_focused: bool, _: &mut ViewContext<Self>) {
|
fn pane_focus_update(&mut self, pane_focused: bool, _: &mut ViewContext<Self>) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue