storybook2: Unsuppress and fix warnings (#3425)

Marshall Bowers created

This PR unsupresses the warnings in `storybook2` and summarily fixes
them.

Release Notes:

- N/A

Change summary

crates/storybook2/src/stories/focus.rs        | 9 ++++-----
crates/storybook2/src/stories/kitchen_sink.rs | 2 +-
crates/storybook2/src/stories/picker.rs       | 4 ++--
crates/storybook2/src/stories/scroll.rs       | 2 +-
crates/storybook2/src/stories/text.rs         | 4 ++--
crates/storybook2/src/stories/z_index.rs      | 4 ++--
crates/storybook2/src/storybook2.rs           | 6 ++----
7 files changed, 14 insertions(+), 17 deletions(-)

Detailed changes

crates/storybook2/src/stories/focus.rs 🔗

@@ -33,7 +33,6 @@ impl Render for FocusStory {
         let theme = cx.theme();
         let color_1 = theme.status().created;
         let color_2 = theme.status().modified;
-        let color_3 = theme.status().deleted;
         let color_4 = theme.status().conflict;
         let color_5 = theme.status().ignored;
         let color_6 = theme.status().renamed;
@@ -42,10 +41,10 @@ impl Render for FocusStory {
             .id("parent")
             .focusable()
             .key_context("parent")
-            .on_action(cx.listener(|_, action: &ActionA, cx| {
+            .on_action(cx.listener(|_, _action: &ActionA, _cx| {
                 println!("Action A dispatched on parent");
             }))
-            .on_action(cx.listener(|_, action: &ActionB, cx| {
+            .on_action(cx.listener(|_, _action: &ActionB, _cx| {
                 println!("Action B dispatched on parent");
             }))
             .on_focus(cx.listener(|_, _, _| println!("Parent focused")))
@@ -61,7 +60,7 @@ impl Render for FocusStory {
                 div()
                     .track_focus(&self.child_1_focus)
                     .key_context("child-1")
-                    .on_action(cx.listener(|_, action: &ActionB, cx| {
+                    .on_action(cx.listener(|_, _action: &ActionB, _cx| {
                         println!("Action B dispatched on child 1 during");
                     }))
                     .w_full()
@@ -83,7 +82,7 @@ impl Render for FocusStory {
                 div()
                     .track_focus(&self.child_2_focus)
                     .key_context("child-2")
-                    .on_action(cx.listener(|_, action: &ActionC, cx| {
+                    .on_action(cx.listener(|_, _action: &ActionC, _cx| {
                         println!("Action C dispatched on child 2");
                     }))
                     .w_full()

crates/storybook2/src/stories/picker.rs 🔗

@@ -51,7 +51,7 @@ impl PickerDelegate for Delegate {
         &self,
         ix: usize,
         selected: bool,
-        cx: &mut gpui::ViewContext<Picker<Self>>,
+        _cx: &mut gpui::ViewContext<Picker<Self>>,
     ) -> Option<Self::ListItem> {
         let Some(candidate_ix) = self.matches.get(ix) else {
             return None;
@@ -76,7 +76,7 @@ impl PickerDelegate for Delegate {
         cx.notify();
     }
 
-    fn confirm(&mut self, secondary: bool, cx: &mut gpui::ViewContext<Picker<Self>>) {
+    fn confirm(&mut self, secondary: bool, _cx: &mut gpui::ViewContext<Picker<Self>>) {
         let candidate_ix = self.matches[self.selected_ix];
         let candidate = self.candidates[candidate_ix].string.clone();
 

crates/storybook2/src/stories/scroll.rs 🔗

@@ -6,7 +6,7 @@ pub struct ScrollStory;
 
 impl ScrollStory {
     pub fn view(cx: &mut WindowContext) -> View<ScrollStory> {
-        cx.build_view(|cx| ScrollStory)
+        cx.build_view(|_cx| ScrollStory)
     }
 }
 

crates/storybook2/src/stories/text.rs 🔗

@@ -8,7 +8,7 @@ pub struct TextStory;
 
 impl TextStory {
     pub fn view(cx: &mut WindowContext) -> View<Self> {
-        cx.build_view(|cx| Self)
+        cx.build_view(|_cx| Self)
     }
 }
 
@@ -68,7 +68,7 @@ impl Render for TextStory {
                         cx.text_style().to_run(18),
                     ]),
                 )
-                .on_click(vec![2..4, 1..3, 7..9], |range_ix, cx| {
+                .on_click(vec![2..4, 1..3, 7..9], |range_ix, _cx| {
                     println!("Clicked range {range_ix}");
                 })
             )

crates/storybook2/src/stories/z_index.rs 🔗

@@ -9,7 +9,7 @@ pub struct ZIndexStory;
 impl Render for ZIndexStory {
     type Element = Div;
 
-    fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+    fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
         Story::container().child(Story::title("z-index")).child(
             div()
                 .flex()
@@ -84,7 +84,7 @@ struct ZIndexExample {
 impl RenderOnce for ZIndexExample {
     type Rendered = Div;
 
-    fn render(self, cx: &mut WindowContext) -> Self::Rendered {
+    fn render(self, _cx: &mut WindowContext) -> Self::Rendered {
         div()
             .relative()
             .size_full()

crates/storybook2/src/storybook2.rs 🔗

@@ -1,5 +1,3 @@
-#![allow(dead_code, unused_variables)]
-
 mod assets;
 mod stories;
 mod story_selector;
@@ -70,7 +68,7 @@ fn main() {
         language::init(cx);
         editor::init(cx);
 
-        let window = cx.open_window(
+        let _window = cx.open_window(
             WindowOptions {
                 bounds: WindowBounds::Fixed(Bounds {
                     origin: Default::default(),
@@ -104,7 +102,7 @@ impl StoryWrapper {
 impl Render for StoryWrapper {
     type Element = Div;
 
-    fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+    fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
         div()
             .flex()
             .flex_col()