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 unnecessary constructor and `Clone` derives

Marshall Bowersc7b79c9aef98
diff --git a/crates/ui2/src/components/context_menu.rs b/crates/ui2/src/components/context_menu.rs
index 3772fb1bd26..f071d188a12 100644
--- a/crates/ui2/src/components/context_menu.rs
+++ b/crates/ui2/src/components/context_menu.rs
@@ -171,7 +171,7 @@ impl Render for ContextMenu {
.child(
List::new().children(self.items.iter().enumerate().map(
|(ix, item)| match item {
- ContextMenuItem::Separator => ListSeparator::new().into_any_element(),
+ ContextMenuItem::Separator => ListSeparator.into_any_element(),
ContextMenuItem::Header(header) => {
ListSubHeader::new(header.clone()).into_any_element()
}
diff --git a/crates/ui2/src/components/list/list_separator.rs b/crates/ui2/src/components/list/list_separator.rs
index e986c8014d2..0398a110e97 100644
--- a/crates/ui2/src/components/list/list_separator.rs
+++ b/crates/ui2/src/components/list/list_separator.rs
@@ -2,15 +2,9 @@ use gpui::Div;
use crate::prelude::*;
-#[derive(IntoElement, Clone)]
+#[derive(IntoElement)]
pub struct ListSeparator;
-impl ListSeparator {
- pub fn new() -> Self {
- Self
- }
-}
-
impl RenderOnce for ListSeparator {
type Rendered = Div;
diff --git a/crates/ui2/src/components/list/list_sub_header.rs b/crates/ui2/src/components/list/list_sub_header.rs
index 361e721e18f..17f07b7b0bf 100644
--- a/crates/ui2/src/components/list/list_sub_header.rs
+++ b/crates/ui2/src/components/list/list_sub_header.rs
@@ -3,7 +3,7 @@ use gpui::Div;
use crate::prelude::*;
use crate::{h_stack, Icon, IconElement, IconSize, Label};
-#[derive(IntoElement, Clone)]
+#[derive(IntoElement)]
pub struct ListSubHeader {
label: SharedString,
left_icon: Option<Icon>,