Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
context_menu: Use `when` instead of if-block (#24566)
Finn Evers0fd220366538
diff --git a/crates/ui/src/components/context_menu.rs b/crates/ui/src/components/context_menu.rsindex b827a576673..2ebaa551052 100644--- a/crates/ui/src/components/context_menu.rs+++ b/crates/ui/src/components/context_menu.rs@@ -671,18 +671,16 @@ impl Render for ContextMenu {.when_some(*toggle,|list_item, (position, toggled)| {- let contents = if toggled {+ let contents =div().flex_none().child(Icon::new(IconName::Check).color(Color::Accent).size(*icon_size))- } else {- div().flex_none().child(- Icon::new(IconName::Check)- .size(*icon_size)- ).invisible()- };+ .when(!toggled, |contents|+ contents.invisible()+ );+match position {IconPosition::Start => {list_item