Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Remove `set_` prefix for `List` setters
Marshall Bowerscf380a9f628e
diff --git a/crates/ui2/src/components/collab_panel.rs b/crates/ui2/src/components/collab_panel.rsindex 7c53891506b..7be29e10304 100644--- a/crates/ui2/src/components/collab_panel.rs+++ b/crates/ui2/src/components/collab_panel.rs@@ -37,20 +37,18 @@ impl<S: 'static + Send + Sync> CollabPanel<S> {List::new(static_collab_panel_current_call()).header(ListHeader::new("CRDB")- .set_left_icon(Icon::Hash.into())- .set_toggle(ToggleState::Toggled),+ .left_icon(Icon::Hash.into())+ .toggle(ToggleState::Toggled),)- .set_toggle(ToggleState::Toggled),+ .toggle(ToggleState::Toggled),),).child(v_stack().id("channels").py_1().child(List::new(static_collab_panel_channels())- .header(- ListHeader::new("CHANNELS").set_toggle(ToggleState::Toggled),- )+ .header(ListHeader::new("CHANNELS").toggle(ToggleState::Toggled)).empty_message("No channels yet. Add a channel to get started.")- .set_toggle(ToggleState::Toggled),+ .toggle(ToggleState::Toggled),),).child(@@ -58,9 +56,9 @@ impl<S: 'static + Send + Sync> CollabPanel<S> {List::new(static_collab_panel_current_call()).header(ListHeader::new("CONTACTS – ONLINE")- .set_toggle(ToggleState::Toggled),+ .toggle(ToggleState::Toggled),)- .set_toggle(ToggleState::Toggled),+ .toggle(ToggleState::Toggled),),).child(@@ -68,9 +66,9 @@ impl<S: 'static + Send + Sync> CollabPanel<S> {List::new(static_collab_panel_current_call()).header(ListHeader::new("CONTACTS – OFFLINE")- .set_toggle(ToggleState::NotToggled),+ .toggle(ToggleState::NotToggled),)- .set_toggle(ToggleState::NotToggled),+ .toggle(ToggleState::NotToggled),),),)diff --git a/crates/ui2/src/components/context_menu.rs b/crates/ui2/src/components/context_menu.rsindex aa07f9a5804..d99eac1b7de 100644--- a/crates/ui2/src/components/context_menu.rs+++ b/crates/ui2/src/components/context_menu.rs@@ -11,9 +11,9 @@ impl<S: 'static + Send + Sync> ContextMenuItem<S> {fn to_list_item(self) -> ListItem<S> {match self {ContextMenuItem::Header(label) => ListSubHeader::new(label).into(),- ContextMenuItem::Entry(label) => ListEntry::new(label)- .set_variant(ListItemVariant::Inset)- .into(),+ ContextMenuItem::Entry(label) => {+ ListEntry::new(label).variant(ListItemVariant::Inset).into()+ }ContextMenuItem::Separator => ListSeparator::new().into(),}}@@ -57,7 +57,7 @@ impl<S: 'static + Send + Sync> ContextMenu<S> {.map(ContextMenuItem::to_list_item).collect(),)- .set_toggle(ToggleState::Toggled),+ .toggle(ToggleState::Toggled),)}}diff --git a/crates/ui2/src/components/list.rs b/crates/ui2/src/components/list.rsindex 0cb5186556a..56bd931121c 100644--- a/crates/ui2/src/components/list.rs+++ b/crates/ui2/src/components/list.rs@@ -39,17 +39,17 @@ impl<S: 'static + Send + Sync> ListHeader<S> {}}- pub fn set_toggle(mut self, toggle: ToggleState) -> Self {+ pub fn toggle(mut self, toggle: ToggleState) -> Self {self.toggleable = toggle.into();self}- pub fn set_toggleable(mut self, toggleable: Toggleable) -> Self {+ pub fn toggleable(mut self, toggleable: Toggleable) -> Self {self.toggleable = toggleable;self}- pub fn set_left_icon(mut self, left_icon: Option<Icon>) -> Self {+ pub fn left_icon(mut self, left_icon: Option<Icon>) -> Self {self.left_icon = left_icon;self}@@ -283,46 +283,48 @@ impl<S: 'static + Send + Sync> ListEntry<S> {overflow: OverflowStyle::Hidden,}}- pub fn set_variant(mut self, variant: ListItemVariant) -> Self {++ pub fn variant(mut self, variant: ListItemVariant) -> Self {self.variant = variant;self}- pub fn set_indent_level(mut self, indent_level: u32) -> Self {++ pub fn indent_level(mut self, indent_level: u32) -> Self {self.indent_level = indent_level;self}- pub fn set_toggle(mut self, toggle: ToggleState) -> Self {+ pub fn toggle(mut self, toggle: ToggleState) -> Self {self.toggle = Some(toggle);self}- pub fn set_left_content(mut self, left_content: LeftContent) -> Self {+ pub fn left_content(mut self, left_content: LeftContent) -> Self {self.left_content = Some(left_content);self}- pub fn set_left_icon(mut self, left_icon: Icon) -> Self {+ pub fn left_icon(mut self, left_icon: Icon) -> Self {self.left_content = Some(LeftContent::Icon(left_icon));self}- pub fn set_left_avatar(mut self, left_avatar: impl Into<SharedString>) -> Self {+ pub fn left_avatar(mut self, left_avatar: impl Into<SharedString>) -> Self {self.left_content = Some(LeftContent::Avatar(left_avatar.into()));self}- pub fn set_state(mut self, state: InteractionState) -> Self {+ pub fn state(mut self, state: InteractionState) -> Self {self.state = state;self}- pub fn set_size(mut self, size: ListEntrySize) -> Self {+ pub fn size(mut self, size: ListEntrySize) -> Self {self.size = size;self}- pub fn set_disclosure_control_style(+ pub fn disclosure_control_style(mut self,disclosure_control_style: DisclosureControlVisibility,) -> Self {@@ -572,7 +574,7 @@ impl<S: 'static + Send + Sync> List<S> {self}- pub fn set_toggle(mut self, toggle: ToggleState) -> Self {+ pub fn toggle(mut self, toggle: ToggleState) -> Self {self.toggleable = toggle.into();self}@@ -595,7 +597,7 @@ impl<S: 'static + Send + Sync> List<S> {.children(self.header.take()- .map(|header| header.set_toggleable(self.toggleable)),+ .map(|header| header.toggleable(self.toggleable)),).child(list_content)}diff --git a/crates/ui2/src/components/notifications_panel.rs b/crates/ui2/src/components/notifications_panel.rsindex 467928ff43e..026c34539f8 100644--- a/crates/ui2/src/components/notifications_panel.rs+++ b/crates/ui2/src/components/notifications_panel.rs@@ -36,14 +36,14 @@ impl<S: 'static + Send + Sync> NotificationsPanel<S> {.overflow_y_scroll().child(List::new(static_new_notification_items())- .header(ListHeader::new("NEW").set_toggle(ToggleState::Toggled))- .set_toggle(ToggleState::Toggled),+ .header(ListHeader::new("NEW").toggle(ToggleState::Toggled))+ .toggle(ToggleState::Toggled),).child(List::new(static_read_notification_items())- .header(ListHeader::new("EARLIER").set_toggle(ToggleState::Toggled))+ .header(ListHeader::new("EARLIER").toggle(ToggleState::Toggled)).empty_message("No new notifications")- .set_toggle(ToggleState::Toggled),+ .toggle(ToggleState::Toggled),),)}diff --git a/crates/ui2/src/components/project_panel.rs b/crates/ui2/src/components/project_panel.rsindex a6b755d67ec..aa50e0e044d 100644--- a/crates/ui2/src/components/project_panel.rs+++ b/crates/ui2/src/components/project_panel.rs@@ -38,15 +38,15 @@ impl<S: 'static + Send + Sync> ProjectPanel<S> {.overflow_y_scroll().child(List::new(static_project_panel_single_items())- .header(ListHeader::new("FILES").set_toggle(ToggleState::Toggled))+ .header(ListHeader::new("FILES").toggle(ToggleState::Toggled)).empty_message("No files in directory")- .set_toggle(ToggleState::Toggled),+ .toggle(ToggleState::Toggled),).child(List::new(static_project_panel_project_items())- .header(ListHeader::new("PROJECT").set_toggle(ToggleState::Toggled))+ .header(ListHeader::new("PROJECT").toggle(ToggleState::Toggled)).empty_message("No folders in directory")- .set_toggle(ToggleState::Toggled),+ .toggle(ToggleState::Toggled),),).child(diff --git a/crates/ui2/src/static_data.rs b/crates/ui2/src/static_data.rsindex 907353544dc..c01389d0047 100644--- a/crates/ui2/src/static_data.rs+++ b/crates/ui2/src/static_data.rs@@ -354,124 +354,124 @@ pub fn static_read_notification_items<S: 'static + Send + Sync>() -> Vec<ListItepub fn static_project_panel_project_items<S: 'static + Send + Sync>() -> Vec<ListItem<S>> {vec![ListEntry::new(Label::new("zed"))- .set_left_icon(Icon::FolderOpen.into())- .set_indent_level(0)- .set_toggle(ToggleState::Toggled),+ .left_icon(Icon::FolderOpen.into())+ .indent_level(0)+ .toggle(ToggleState::Toggled),ListEntry::new(Label::new(".cargo"))- .set_left_icon(Icon::Folder.into())- .set_indent_level(1),+ .left_icon(Icon::Folder.into())+ .indent_level(1),ListEntry::new(Label::new(".config"))- .set_left_icon(Icon::Folder.into())- .set_indent_level(1),+ .left_icon(Icon::Folder.into())+ .indent_level(1),ListEntry::new(Label::new(".git").color(LabelColor::Hidden))- .set_left_icon(Icon::Folder.into())- .set_indent_level(1),+ .left_icon(Icon::Folder.into())+ .indent_level(1),ListEntry::new(Label::new(".cargo"))- .set_left_icon(Icon::Folder.into())- .set_indent_level(1),+ .left_icon(Icon::Folder.into())+ .indent_level(1),ListEntry::new(Label::new(".idea").color(LabelColor::Hidden))- .set_left_icon(Icon::Folder.into())- .set_indent_level(1),+ .left_icon(Icon::Folder.into())+ .indent_level(1),ListEntry::new(Label::new("assets"))- .set_left_icon(Icon::Folder.into())- .set_indent_level(1)- .set_toggle(ToggleState::Toggled),+ .left_icon(Icon::Folder.into())+ .indent_level(1)+ .toggle(ToggleState::Toggled),ListEntry::new(Label::new("cargo-target").color(LabelColor::Hidden))- .set_left_icon(Icon::Folder.into())- .set_indent_level(1),+ .left_icon(Icon::Folder.into())+ .indent_level(1),ListEntry::new(Label::new("crates"))- .set_left_icon(Icon::FolderOpen.into())- .set_indent_level(1)- .set_toggle(ToggleState::Toggled),+ .left_icon(Icon::FolderOpen.into())+ .indent_level(1)+ .toggle(ToggleState::Toggled),ListEntry::new(Label::new("activity_indicator"))- .set_left_icon(Icon::Folder.into())- .set_indent_level(2),+ .left_icon(Icon::Folder.into())+ .indent_level(2),ListEntry::new(Label::new("ai"))- .set_left_icon(Icon::Folder.into())- .set_indent_level(2),+ .left_icon(Icon::Folder.into())+ .indent_level(2),ListEntry::new(Label::new("audio"))- .set_left_icon(Icon::Folder.into())- .set_indent_level(2),+ .left_icon(Icon::Folder.into())+ .indent_level(2),ListEntry::new(Label::new("auto_update"))- .set_left_icon(Icon::Folder.into())- .set_indent_level(2),+ .left_icon(Icon::Folder.into())+ .indent_level(2),ListEntry::new(Label::new("breadcrumbs"))- .set_left_icon(Icon::Folder.into())- .set_indent_level(2),+ .left_icon(Icon::Folder.into())+ .indent_level(2),ListEntry::new(Label::new("call"))- .set_left_icon(Icon::Folder.into())- .set_indent_level(2),+ .left_icon(Icon::Folder.into())+ .indent_level(2),ListEntry::new(Label::new("sqlez").color(LabelColor::Modified))- .set_left_icon(Icon::Folder.into())- .set_indent_level(2)- .set_toggle(ToggleState::NotToggled),+ .left_icon(Icon::Folder.into())+ .indent_level(2)+ .toggle(ToggleState::NotToggled),ListEntry::new(Label::new("gpui2"))- .set_left_icon(Icon::FolderOpen.into())- .set_indent_level(2)- .set_toggle(ToggleState::Toggled),+ .left_icon(Icon::FolderOpen.into())+ .indent_level(2)+ .toggle(ToggleState::Toggled),ListEntry::new(Label::new("src"))- .set_left_icon(Icon::FolderOpen.into())- .set_indent_level(3)- .set_toggle(ToggleState::Toggled),+ .left_icon(Icon::FolderOpen.into())+ .indent_level(3)+ .toggle(ToggleState::Toggled),ListEntry::new(Label::new("derive_element.rs"))- .set_left_icon(Icon::FileRust.into())- .set_indent_level(4),+ .left_icon(Icon::FileRust.into())+ .indent_level(4),ListEntry::new(Label::new("storybook").color(LabelColor::Modified))- .set_left_icon(Icon::FolderOpen.into())- .set_indent_level(1)- .set_toggle(ToggleState::Toggled),+ .left_icon(Icon::FolderOpen.into())+ .indent_level(1)+ .toggle(ToggleState::Toggled),ListEntry::new(Label::new("docs").color(LabelColor::Default))- .set_left_icon(Icon::Folder.into())- .set_indent_level(2)- .set_toggle(ToggleState::Toggled),+ .left_icon(Icon::Folder.into())+ .indent_level(2)+ .toggle(ToggleState::Toggled),ListEntry::new(Label::new("src").color(LabelColor::Modified))- .set_left_icon(Icon::FolderOpen.into())- .set_indent_level(3)- .set_toggle(ToggleState::Toggled),+ .left_icon(Icon::FolderOpen.into())+ .indent_level(3)+ .toggle(ToggleState::Toggled),ListEntry::new(Label::new("ui").color(LabelColor::Modified))- .set_left_icon(Icon::FolderOpen.into())- .set_indent_level(4)- .set_toggle(ToggleState::Toggled),+ .left_icon(Icon::FolderOpen.into())+ .indent_level(4)+ .toggle(ToggleState::Toggled),ListEntry::new(Label::new("component").color(LabelColor::Created))- .set_left_icon(Icon::FolderOpen.into())- .set_indent_level(5)- .set_toggle(ToggleState::Toggled),+ .left_icon(Icon::FolderOpen.into())+ .indent_level(5)+ .toggle(ToggleState::Toggled),ListEntry::new(Label::new("facepile.rs").color(LabelColor::Default))- .set_left_icon(Icon::FileRust.into())- .set_indent_level(6),+ .left_icon(Icon::FileRust.into())+ .indent_level(6),ListEntry::new(Label::new("follow_group.rs").color(LabelColor::Default))- .set_left_icon(Icon::FileRust.into())- .set_indent_level(6),+ .left_icon(Icon::FileRust.into())+ .indent_level(6),ListEntry::new(Label::new("list_item.rs").color(LabelColor::Created))- .set_left_icon(Icon::FileRust.into())- .set_indent_level(6),+ .left_icon(Icon::FileRust.into())+ .indent_level(6),ListEntry::new(Label::new("tab.rs").color(LabelColor::Default))- .set_left_icon(Icon::FileRust.into())- .set_indent_level(6),+ .left_icon(Icon::FileRust.into())+ .indent_level(6),ListEntry::new(Label::new("target").color(LabelColor::Hidden))- .set_left_icon(Icon::Folder.into())- .set_indent_level(1),+ .left_icon(Icon::Folder.into())+ .indent_level(1),ListEntry::new(Label::new(".dockerignore"))- .set_left_icon(Icon::FileGeneric.into())- .set_indent_level(1),+ .left_icon(Icon::FileGeneric.into())+ .indent_level(1),ListEntry::new(Label::new(".DS_Store").color(LabelColor::Hidden))- .set_left_icon(Icon::FileGeneric.into())- .set_indent_level(1),+ .left_icon(Icon::FileGeneric.into())+ .indent_level(1),ListEntry::new(Label::new("Cargo.lock"))- .set_left_icon(Icon::FileLock.into())- .set_indent_level(1),+ .left_icon(Icon::FileLock.into())+ .indent_level(1),ListEntry::new(Label::new("Cargo.toml"))- .set_left_icon(Icon::FileToml.into())- .set_indent_level(1),+ .left_icon(Icon::FileToml.into())+ .indent_level(1),ListEntry::new(Label::new("Dockerfile"))- .set_left_icon(Icon::FileGeneric.into())- .set_indent_level(1),+ .left_icon(Icon::FileGeneric.into())+ .indent_level(1),ListEntry::new(Label::new("Procfile"))- .set_left_icon(Icon::FileGeneric.into())- .set_indent_level(1),+ .left_icon(Icon::FileGeneric.into())+ .indent_level(1),ListEntry::new(Label::new("README.md"))- .set_left_icon(Icon::FileDoc.into())- .set_indent_level(1),+ .left_icon(Icon::FileDoc.into())+ .indent_level(1),].into_iter().map(From::from)@@ -481,14 +481,14 @@ pub fn static_project_panel_project_items<S: 'static + Send + Sync>() -> Vec<Lispub fn static_project_panel_single_items<S: 'static + Send + Sync>() -> Vec<ListItem<S>> {vec![ListEntry::new(Label::new("todo.md"))- .set_left_icon(Icon::FileDoc.into())- .set_indent_level(0),+ .left_icon(Icon::FileDoc.into())+ .indent_level(0),ListEntry::new(Label::new("README.md"))- .set_left_icon(Icon::FileDoc.into())- .set_indent_level(0),+ .left_icon(Icon::FileDoc.into())+ .indent_level(0),ListEntry::new(Label::new("config.json"))- .set_left_icon(Icon::FileGeneric.into())- .set_indent_level(0),+ .left_icon(Icon::FileGeneric.into())+ .indent_level(0),].into_iter().map(From::from)@@ -497,11 +497,11 @@ pub fn static_project_panel_single_items<S: 'static + Send + Sync>() -> Vec<Listpub fn static_collab_panel_current_call<S: 'static + Send + Sync>() -> Vec<ListItem<S>> {vec![- ListEntry::new(Label::new("as-cii")).set_left_avatar("http://github.com/as-cii.png?s=50"),+ ListEntry::new(Label::new("as-cii")).left_avatar("http://github.com/as-cii.png?s=50"),ListEntry::new(Label::new("nathansobo"))- .set_left_avatar("http://github.com/nathansobo.png?s=50"),+ .left_avatar("http://github.com/nathansobo.png?s=50"),ListEntry::new(Label::new("maxbrunsfeld"))- .set_left_avatar("http://github.com/maxbrunsfeld.png?s=50"),+ .left_avatar("http://github.com/maxbrunsfeld.png?s=50"),].into_iter().map(From::from)@@ -511,61 +511,61 @@ pub fn static_collab_panel_current_call<S: 'static + Send + Sync>() -> Vec<ListIpub fn static_collab_panel_channels<S: 'static + Send + Sync>() -> Vec<ListItem<S>> {vec![ListEntry::new(Label::new("zed"))- .set_left_icon(Icon::Hash.into())- .set_size(ListEntrySize::Medium)- .set_indent_level(0),+ .left_icon(Icon::Hash.into())+ .size(ListEntrySize::Medium)+ .indent_level(0),ListEntry::new(Label::new("community"))- .set_left_icon(Icon::Hash.into())- .set_size(ListEntrySize::Medium)- .set_indent_level(1),+ .left_icon(Icon::Hash.into())+ .size(ListEntrySize::Medium)+ .indent_level(1),ListEntry::new(Label::new("dashboards"))- .set_left_icon(Icon::Hash.into())- .set_size(ListEntrySize::Medium)- .set_indent_level(2),+ .left_icon(Icon::Hash.into())+ .size(ListEntrySize::Medium)+ .indent_level(2),ListEntry::new(Label::new("feedback"))- .set_left_icon(Icon::Hash.into())- .set_size(ListEntrySize::Medium)- .set_indent_level(2),+ .left_icon(Icon::Hash.into())+ .size(ListEntrySize::Medium)+ .indent_level(2),ListEntry::new(Label::new("teams-in-channels-alpha"))- .set_left_icon(Icon::Hash.into())- .set_size(ListEntrySize::Medium)- .set_indent_level(2),+ .left_icon(Icon::Hash.into())+ .size(ListEntrySize::Medium)+ .indent_level(2),ListEntry::new(Label::new("current-projects"))- .set_left_icon(Icon::Hash.into())- .set_size(ListEntrySize::Medium)- .set_indent_level(1),+ .left_icon(Icon::Hash.into())+ .size(ListEntrySize::Medium)+ .indent_level(1),ListEntry::new(Label::new("codegen"))- .set_left_icon(Icon::Hash.into())- .set_size(ListEntrySize::Medium)- .set_indent_level(2),+ .left_icon(Icon::Hash.into())+ .size(ListEntrySize::Medium)+ .indent_level(2),ListEntry::new(Label::new("gpui2"))- .set_left_icon(Icon::Hash.into())- .set_size(ListEntrySize::Medium)- .set_indent_level(2),+ .left_icon(Icon::Hash.into())+ .size(ListEntrySize::Medium)+ .indent_level(2),ListEntry::new(Label::new("livestreaming"))- .set_left_icon(Icon::Hash.into())- .set_size(ListEntrySize::Medium)- .set_indent_level(2),+ .left_icon(Icon::Hash.into())+ .size(ListEntrySize::Medium)+ .indent_level(2),ListEntry::new(Label::new("open-source"))- .set_left_icon(Icon::Hash.into())- .set_size(ListEntrySize::Medium)- .set_indent_level(2),+ .left_icon(Icon::Hash.into())+ .size(ListEntrySize::Medium)+ .indent_level(2),ListEntry::new(Label::new("replace"))- .set_left_icon(Icon::Hash.into())- .set_size(ListEntrySize::Medium)- .set_indent_level(2),+ .left_icon(Icon::Hash.into())+ .size(ListEntrySize::Medium)+ .indent_level(2),ListEntry::new(Label::new("semantic-index"))- .set_left_icon(Icon::Hash.into())- .set_size(ListEntrySize::Medium)- .set_indent_level(2),+ .left_icon(Icon::Hash.into())+ .size(ListEntrySize::Medium)+ .indent_level(2),ListEntry::new(Label::new("vim"))- .set_left_icon(Icon::Hash.into())- .set_size(ListEntrySize::Medium)- .set_indent_level(2),+ .left_icon(Icon::Hash.into())+ .size(ListEntrySize::Medium)+ .indent_level(2),ListEntry::new(Label::new("web-tech"))- .set_left_icon(Icon::Hash.into())- .set_size(ListEntrySize::Medium)- .set_indent_level(2),+ .left_icon(Icon::Hash.into())+ .size(ListEntrySize::Medium)+ .indent_level(2),].into_iter().map(From::from)