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 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()
@@ -9,7 +9,7 @@ pub struct KitchenSinkStory;
impl KitchenSinkStory {
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,
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();
+1 -1
View File
@@ -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)
}
}
+2 -2
View File
@@ -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}");
})
)
+2 -2
View File
@@ -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()
+2 -4
View File
@@ -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()