Skip to content

Commit c2c1b15

Browse files
committed
refactor(dock): simplify panel lookup with conditional let
1 parent 2c6bf70 commit c2c1b15

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/dock.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -450,10 +450,10 @@ impl TileLayoutState {
450450
panel_str_id: &str,
451451
) -> Option<&mut T> {
452452
// First try the built panels map
453-
if let Some(&panel_id) = self.panel_id_map.get(panel_str_id) {
454-
if let Some(panel) = self.panels.get_mut(&panel_id) {
455-
return (panel.as_mut() as &mut dyn std::any::Any).downcast_mut::<T>();
456-
}
453+
if let Some(&panel_id) = self.panel_id_map.get(panel_str_id)
454+
&& let Some(panel) = self.panels.get_mut(&panel_id)
455+
{
456+
return (panel.as_mut() as &mut dyn std::any::Any).downcast_mut::<T>();
457457
}
458458
// Fall back to pending panels (not yet moved into the map)
459459
for pending in &mut self.pending {

0 commit comments

Comments
 (0)