Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Remove `Clone` bound from `IconElement`

Marshall Bowerse1e8b63eb535
diff --git a/crates/ui2/src/components/tab.rs b/crates/ui2/src/components/tab.rs
index 36adb601785..6eebaa1e0b4 100644
--- a/crates/ui2/src/components/tab.rs
+++ b/crates/ui2/src/components/tab.rs
@@ -94,7 +94,7 @@ impl<S: 'static + Send + Sync + Clone> Tab<S> {
(GitStatus::Conflict, false) => Label::new(self.title.clone()),
};
- let close_icon = IconElement::new(Icon::Close).color(IconColor::Muted);
+ let close_icon = || IconElement::new(Icon::Close).color(IconColor::Muted);
let (tab_bg, tab_hover_bg, tab_active_bg) = match self.current {
true => (
@@ -131,13 +131,13 @@ impl<S: 'static + Send + Sync + Clone> Tab<S> {
}))
.children(self.icon.map(IconElement::new))
.children(if self.close_side == IconSide::Left {
- Some(close_icon.clone())
+ Some(close_icon())
} else {
None
})
.child(label)
.children(if self.close_side == IconSide::Right {
- Some(close_icon)
+ Some(close_icon())
} else {
None
}),
diff --git a/crates/ui2/src/elements/icon.rs b/crates/ui2/src/elements/icon.rs
index a5b6adff489..662aefe12fa 100644
--- a/crates/ui2/src/elements/icon.rs
+++ b/crates/ui2/src/elements/icon.rs
@@ -148,7 +148,7 @@ impl Icon {
}
}
-#[derive(Element, Clone)]
+#[derive(Element)]
pub struct IconElement<S: 'static + Send + Sync> {
state_type: PhantomData<S>,
icon: Icon,