Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
ui2: Clean up `take`s
Marshall Bowerseb19071d8499
diff --git a/crates/ui2/src/components/list.rs b/crates/ui2/src/components/list.rsindex c629f6b89c3..bfd650b390d 100644--- a/crates/ui2/src/components/list.rs+++ b/crates/ui2/src/components/list.rs@@ -250,7 +250,7 @@ impl<S: 'static> ListItem<S> {pub struct ListEntry {disclosure_control_style: DisclosureControlVisibility,indent_level: u32,- label: Option<Label>,+ label: Label,left_content: Option<LeftContent>,variant: ListItemVariant,size: ListEntrySize,@@ -264,7 +264,7 @@ impl ListEntry {Self {disclosure_control_style: DisclosureControlVisibility::default(),indent_level: 0,- label: Some(label),+ label,variant: ListItemVariant::default(),left_content: None,size: ListEntrySize::default(),@@ -412,7 +412,7 @@ impl ListEntry {.relative().children(self.disclosure_control(cx)).children(left_content)- .children(self.label.take()),+ .child(self.label),)}}diff --git a/crates/ui2/src/components/modal.rs b/crates/ui2/src/components/modal.rsindex a83d1146886..0ed1b0c72f8 100644--- a/crates/ui2/src/components/modal.rs+++ b/crates/ui2/src/components/modal.rs@@ -38,7 +38,7 @@ impl<S: 'static> Modal<S> {self}- fn render(mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {let theme = theme(cx);v_stack()@@ -68,8 +68,8 @@ impl<S: 'static> Modal<S> {.border_color(theme.border).p_1().justify_end()- .children(self.secondary_action.take())- .children(self.primary_action.take()),+ .children(self.secondary_action)+ .children(self.primary_action),)},)diff --git a/crates/ui2/src/components/palette.rs b/crates/ui2/src/components/palette.rsindex 254afd94c42..c2b7ba7e6c8 100644--- a/crates/ui2/src/components/palette.rs+++ b/crates/ui2/src/components/palette.rs@@ -131,7 +131,7 @@ impl PaletteItem {self}- fn render<S: 'static>(mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render<S: 'static>(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {div().flex().flex_row()@@ -142,7 +142,7 @@ impl PaletteItem {.child(Label::new(self.label.clone())).children(self.sublabel.clone().map(|sublabel| Label::new(sublabel))),)- .children(self.keybinding.take())+ .children(self.keybinding)}}diff --git a/crates/ui2/src/elements/details.rs b/crates/ui2/src/elements/details.rsindex e39b8b9e1a1..21918297313 100644--- a/crates/ui2/src/elements/details.rs+++ b/crates/ui2/src/elements/details.rs@@ -26,7 +26,7 @@ impl<S: 'static> Details<S> {self}- fn render(mut self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {+ fn render(self, _view: &mut S, cx: &mut ViewContext<S>) -> impl Component<S> {let theme = theme(cx);v_stack()@@ -37,7 +37,7 @@ impl<S: 'static> Details<S> {.size_full().child(self.text).children(self.meta.map(|m| m))- .children(self.actions.take().map(|a| a))+ .children(self.actions.map(|a| a))}}