storybook2: Unsuppress and fix warnings (#3425)

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

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers
2023-11-28 15:43:43 -05:00
committed by GitHub
parent 64376ad37a
commit 8ee84249ec
7 changed files with 14 additions and 17 deletions
+4 -5
View File
@@ -33,7 +33,6 @@ impl Render for FocusStory {
let theme = cx.theme(); let theme = cx.theme();
let color_1 = theme.status().created; let color_1 = theme.status().created;
let color_2 = theme.status().modified; let color_2 = theme.status().modified;
let color_3 = theme.status().deleted;
let color_4 = theme.status().conflict; let color_4 = theme.status().conflict;
let color_5 = theme.status().ignored; let color_5 = theme.status().ignored;
let color_6 = theme.status().renamed; let color_6 = theme.status().renamed;
@@ -42,10 +41,10 @@ impl Render for FocusStory {
.id("parent") .id("parent")
.focusable() .focusable()
.key_context("parent") .key_context("parent")
.on_action(cx.listener(|_, action: &ActionA, cx| { .on_action(cx.listener(|_, _action: &ActionA, _cx| {
println!("Action A dispatched on parent"); 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"); println!("Action B dispatched on parent");
})) }))
.on_focus(cx.listener(|_, _, _| println!("Parent focused"))) .on_focus(cx.listener(|_, _, _| println!("Parent focused")))
@@ -61,7 +60,7 @@ impl Render for FocusStory {
div() div()
.track_focus(&self.child_1_focus) .track_focus(&self.child_1_focus)
.key_context("child-1") .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"); println!("Action B dispatched on child 1 during");
})) }))
.w_full() .w_full()
@@ -83,7 +82,7 @@ impl Render for FocusStory {
div() div()
.track_focus(&self.child_2_focus) .track_focus(&self.child_2_focus)
.key_context("child-2") .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"); println!("Action C dispatched on child 2");
})) }))
.w_full() .w_full()
@@ -9,7 +9,7 @@ pub struct KitchenSinkStory;
impl KitchenSinkStory { impl KitchenSinkStory {
pub fn view(cx: &mut WindowContext) -> View<Self> { pub fn view(cx: &mut WindowContext) -> View<Self> {
cx.build_view(|cx| Self) cx.build_view(|_cx| Self)
} }
} }
+2 -2
View File
@@ -51,7 +51,7 @@ impl PickerDelegate for Delegate {
&self, &self,
ix: usize, ix: usize,
selected: bool, selected: bool,
cx: &mut gpui::ViewContext<Picker<Self>>, _cx: &mut gpui::ViewContext<Picker<Self>>,
) -> Option<Self::ListItem> { ) -> Option<Self::ListItem> {
let Some(candidate_ix) = self.matches.get(ix) else { let Some(candidate_ix) = self.matches.get(ix) else {
return None; return None;
@@ -76,7 +76,7 @@ impl PickerDelegate for Delegate {
cx.notify(); 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_ix = self.matches[self.selected_ix];
let candidate = self.candidates[candidate_ix].string.clone(); let candidate = self.candidates[candidate_ix].string.clone();
+1 -1
View File
@@ -6,7 +6,7 @@ pub struct ScrollStory;
impl ScrollStory { impl ScrollStory {
pub fn view(cx: &mut WindowContext) -> View<ScrollStory> { pub fn view(cx: &mut WindowContext) -> View<ScrollStory> {
cx.build_view(|cx| ScrollStory) cx.build_view(|_cx| ScrollStory)
} }
} }
+2 -2
View File
@@ -8,7 +8,7 @@ pub struct TextStory;
impl TextStory { impl TextStory {
pub fn view(cx: &mut WindowContext) -> View<Self> { 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), 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}"); println!("Clicked range {range_ix}");
}) })
) )
+2 -2
View File
@@ -9,7 +9,7 @@ pub struct ZIndexStory;
impl Render for ZIndexStory { impl Render for ZIndexStory {
type Element = Div; 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( Story::container().child(Story::title("z-index")).child(
div() div()
.flex() .flex()
@@ -84,7 +84,7 @@ struct ZIndexExample {
impl RenderOnce for ZIndexExample { impl RenderOnce for ZIndexExample {
type Rendered = Div; type Rendered = Div;
fn render(self, cx: &mut WindowContext) -> Self::Rendered { fn render(self, _cx: &mut WindowContext) -> Self::Rendered {
div() div()
.relative() .relative()
.size_full() .size_full()
+2 -4
View File
@@ -1,5 +1,3 @@
#![allow(dead_code, unused_variables)]
mod assets; mod assets;
mod stories; mod stories;
mod story_selector; mod story_selector;
@@ -70,7 +68,7 @@ fn main() {
language::init(cx); language::init(cx);
editor::init(cx); editor::init(cx);
let window = cx.open_window( let _window = cx.open_window(
WindowOptions { WindowOptions {
bounds: WindowBounds::Fixed(Bounds { bounds: WindowBounds::Fixed(Bounds {
origin: Default::default(), origin: Default::default(),
@@ -104,7 +102,7 @@ impl StoryWrapper {
impl Render for StoryWrapper { impl Render for StoryWrapper {
type Element = Div; type Element = Div;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element { fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
div() div()
.flex() .flex()
.flex_col() .flex_col()