diff --git a/crates/ui2/src/components/context_menu.rs b/crates/ui2/src/components/context_menu.rs index a92c08d82fae0164d0488e350f273df86f7ae48f..8cd519f62916dd351f2056100acb8d396801f8c0 100644 --- a/crates/ui2/src/components/context_menu.rs +++ b/crates/ui2/src/components/context_menu.rs @@ -264,7 +264,7 @@ impl Element for MenuHandle { let new_menu = (builder)(cx); let menu2 = menu.clone(); - cx.subscribe(&new_menu, move |modal, e, cx| match e { + cx.subscribe(&new_menu, move |_modal, e, cx| match e { &DismissEvent::Dismiss => { *menu2.borrow_mut() = None; cx.notify(); diff --git a/crates/ui2/src/components/divider.rs b/crates/ui2/src/components/divider.rs index b203a0feda4dfac5546c62e387de8502fb558140..cb48ce00ae24f031807d8522510aa18bc586d638 100644 --- a/crates/ui2/src/components/divider.rs +++ b/crates/ui2/src/components/divider.rs @@ -49,17 +49,4 @@ impl Divider { self.inset = true; self } - - fn render(self, cx: &mut WindowContext) -> impl Element { - div() - .map(|this| match self.direction { - DividerDirection::Horizontal => { - this.h_px().w_full().when(self.inset, |this| this.mx_1p5()) - } - DividerDirection::Vertical => { - this.w_px().h_full().when(self.inset, |this| this.my_1p5()) - } - }) - .bg(cx.theme().colors().border_variant) - } } diff --git a/crates/ui2/src/components/icon.rs b/crates/ui2/src/components/icon.rs index 575b4fdb2877b91da18ad104b0314a4a696efe70..8190871767d19f65b8cac52648d9a4c8c6fda865 100644 --- a/crates/ui2/src/components/icon.rs +++ b/crates/ui2/src/components/icon.rs @@ -189,17 +189,4 @@ impl IconElement { self.size = size; self } - - fn render(self, cx: &mut WindowContext) -> impl Element { - let svg_size = match self.size { - IconSize::Small => rems(0.75), - IconSize::Medium => rems(0.9375), - }; - - svg() - .size(svg_size) - .flex_none() - .path(self.path) - .text_color(self.color.color(cx)) - } } diff --git a/crates/ui2/src/components/icon_button.rs b/crates/ui2/src/components/icon_button.rs index 1ab35384c9d4bd8d8659079f4debfa8c6d54427c..e23882f5f778934cfc4de37e280908ea11315ceb 100644 --- a/crates/ui2/src/components/icon_button.rs +++ b/crates/ui2/src/components/icon_button.rs @@ -23,15 +23,13 @@ impl RenderOnce for IconButton { _ => self.color, }; - let (mut bg_color, bg_hover_color, bg_active_color) = match self.variant { + let (mut bg_color, bg_active_color) = match self.variant { ButtonVariant::Filled => ( cx.theme().colors().element_background, - cx.theme().colors().element_hover, cx.theme().colors().element_active, ), ButtonVariant::Ghost => ( cx.theme().colors().ghost_element_background, - cx.theme().colors().ghost_element_hover, cx.theme().colors().ghost_element_active, ), }; @@ -124,6 +122,6 @@ impl IconButton { } pub fn action(self, action: Box) -> Self { - self.on_click(move |this, cx| cx.dispatch_action(action.boxed_clone())) + self.on_click(move |_event, cx| cx.dispatch_action(action.boxed_clone())) } } diff --git a/crates/ui2/src/components/keybinding.rs b/crates/ui2/src/components/keybinding.rs index 1da0425ad376aab0cb8db3a0c4c27052a3cda8b5..78300ebe54c25e5cb37a05d41acfc472ba68bf26 100644 --- a/crates/ui2/src/components/keybinding.rs +++ b/crates/ui2/src/components/keybinding.rs @@ -13,7 +13,7 @@ pub struct KeyBinding { impl RenderOnce for KeyBinding { type Rendered = Div; - fn render(self, cx: &mut WindowContext) -> Self::Rendered { + fn render(self, _cx: &mut WindowContext) -> Self::Rendered { div() .flex() .gap_2() diff --git a/crates/ui2/src/components/label.rs b/crates/ui2/src/components/label.rs index 627a95d9534d2a4aadda019d6be59b2977653ed3..562131a96975ad2f8c5986bac2bfdd723c20032d 100644 --- a/crates/ui2/src/components/label.rs +++ b/crates/ui2/src/components/label.rs @@ -1,6 +1,6 @@ use crate::prelude::*; use crate::styled_ext::StyledExt; -use gpui::{relative, Div, Hsla, IntoElement, StyledText, TextRun, WindowContext}; +use gpui::{relative, Div, IntoElement, StyledText, TextRun, WindowContext}; #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, Default)] pub enum LabelSize { @@ -182,9 +182,3 @@ impl HighlightedLabel { self } } - -/// A run of text that receives the same style. -struct Run { - pub text: String, - pub color: Hsla, -} diff --git a/crates/ui2/src/components/list.rs b/crates/ui2/src/components/list.rs index ad04408e13ecec02c871d76b1bd0253259924c40..749de951d9a3055050e18198956eb71c75684cfe 100644 --- a/crates/ui2/src/components/list.rs +++ b/crates/ui2/src/components/list.rs @@ -138,7 +138,7 @@ impl ListSubHeader { impl RenderOnce for ListSubHeader { type Rendered = Div; - fn render(self, cx: &mut WindowContext) -> Self::Rendered { + fn render(self, _cx: &mut WindowContext) -> Self::Rendered { h_stack().flex_1().w_full().relative().py_1().child( div() .h_6() @@ -168,14 +168,12 @@ impl RenderOnce for ListSubHeader { #[derive(IntoElement)] pub struct ListItem { id: ElementId, - disabled: bool, selected: bool, // TODO: Reintroduce this // disclosure_control_style: DisclosureControlVisibility, indent_level: usize, indent_step_size: Pixels, left_slot: Option, - overflow: OverflowStyle, toggle: Toggle, inset: bool, on_click: Option>, @@ -187,12 +185,10 @@ impl ListItem { pub fn new(id: impl Into) -> Self { Self { id: id.into(), - disabled: false, selected: false, indent_level: 0, indent_step_size: px(12.), left_slot: None, - overflow: OverflowStyle::Hidden, toggle: Toggle::NotToggleable, inset: false, on_click: None, @@ -365,7 +361,7 @@ pub struct List { impl RenderOnce for List { type Rendered = Div; - fn render(self, cx: &mut WindowContext) -> Self::Rendered { + fn render(self, _cx: &mut WindowContext) -> Self::Rendered { let list_content = match (self.children.is_empty(), self.toggle) { (false, _) => div().children(self.children), (true, Toggle::Toggled(false)) => div(), diff --git a/crates/ui2/src/components/stories/avatar.rs b/crates/ui2/src/components/stories/avatar.rs index 505ede4ecc98d1248533f806b8fb47fc932a0028..3e830b8b79df059c4257cfad73691dbda938c6a3 100644 --- a/crates/ui2/src/components/stories/avatar.rs +++ b/crates/ui2/src/components/stories/avatar.rs @@ -9,7 +9,7 @@ pub struct AvatarStory; impl Render for AvatarStory { type Element = Div; - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + fn render(&mut self, _cx: &mut ViewContext) -> Self::Element { Story::container() .child(Story::title_for::()) .child(Story::label("Default")) diff --git a/crates/ui2/src/components/stories/button.rs b/crates/ui2/src/components/stories/button.rs index 6a23060c7813034434285e0e6af036a40e8a21b5..7339f95ae2e04afe8bd9aa705e93b219a8ba7869 100644 --- a/crates/ui2/src/components/stories/button.rs +++ b/crates/ui2/src/components/stories/button.rs @@ -10,7 +10,7 @@ pub struct ButtonStory; impl Render for ButtonStory { type Element = Div; - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + fn render(&mut self, _cx: &mut ViewContext) -> Self::Element { let states = InteractionState::iter(); Story::container() @@ -139,7 +139,7 @@ impl Render for ButtonStory { .child( Button::new("Label") .variant(ButtonVariant::Ghost) - .on_click(|_, cx| println!("Button clicked.")), + .on_click(|_, _cx| println!("Button clicked.")), ) } } diff --git a/crates/ui2/src/components/stories/context_menu.rs b/crates/ui2/src/components/stories/context_menu.rs index 98faea70aabdaec14a78757ce4a6a00919932654..9a8b7efbe666bb95317c98299b4ad72d0a1d23cd 100644 --- a/crates/ui2/src/components/stories/context_menu.rs +++ b/crates/ui2/src/components/stories/context_menu.rs @@ -10,11 +10,11 @@ fn build_menu(cx: &mut WindowContext, header: impl Into) -> View) -> Self::Element { + fn render(&mut self, _cx: &mut ViewContext) -> Self::Element { Story::container() .on_action(|_: &PrintCurrentDate, _| { println!("printing unix time!"); diff --git a/crates/ui2/src/components/stories/icon.rs b/crates/ui2/src/components/stories/icon.rs index bd3cafd5314d17b06d3b96e0a300cc774c489fd8..ee7dfe532cdf3619bee41c47d2fb94ec95a26b21 100644 --- a/crates/ui2/src/components/stories/icon.rs +++ b/crates/ui2/src/components/stories/icon.rs @@ -10,7 +10,7 @@ pub struct IconStory; impl Render for IconStory { type Element = Div; - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + fn render(&mut self, _cx: &mut ViewContext) -> Self::Element { let icons = Icon::iter(); Story::container() diff --git a/crates/ui2/src/components/stories/input.rs b/crates/ui2/src/components/stories/input.rs index f8eb553e7db6a50415983b9acff78b208be74286..d041543616072e943cb61f2e4e37f5e494e9b66a 100644 --- a/crates/ui2/src/components/stories/input.rs +++ b/crates/ui2/src/components/stories/input.rs @@ -9,7 +9,7 @@ pub struct InputStory; impl Render for InputStory { type Element = Div; - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + fn render(&mut self, _cx: &mut ViewContext) -> Self::Element { Story::container() .child(Story::title_for::()) .child(Story::label("Default")) diff --git a/crates/ui2/src/components/stories/keybinding.rs b/crates/ui2/src/components/stories/keybinding.rs index a1aba23b5930f7e64730bd4c25ed90a0e34308fc..b1b3401f17f5e30f5de28c12c6d72aef53c6a25d 100644 --- a/crates/ui2/src/components/stories/keybinding.rs +++ b/crates/ui2/src/components/stories/keybinding.rs @@ -16,7 +16,7 @@ pub fn binding(key: &str) -> gpui::KeyBinding { impl Render for KeybindingStory { type Element = Div; - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + fn render(&mut self, _cx: &mut ViewContext) -> Self::Element { let all_modifier_permutations = ["ctrl", "alt", "cmd", "shift"].into_iter().permutations(2); Story::container() diff --git a/crates/ui2/src/components/stories/label.rs b/crates/ui2/src/components/stories/label.rs index f19f643ad635c28090ab05cd09f73ff80ae2dd04..2417bee6e1cd77646ceddd2c4febe4c6e45b7e19 100644 --- a/crates/ui2/src/components/stories/label.rs +++ b/crates/ui2/src/components/stories/label.rs @@ -9,7 +9,7 @@ pub struct LabelStory; impl Render for LabelStory { type Element = Div; - fn render(&mut self, cx: &mut ViewContext) -> Self::Element { + fn render(&mut self, _cx: &mut ViewContext) -> Self::Element { Story::container() .child(Story::title_for::