Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

storybook2: Unsuppress and fix warnings (#3425)

Marshall Bowers8ee84249ecfa
diff --git a/crates/storybook2/src/stories/focus.rs b/crates/storybook2/src/stories/focus.rs
index 6f757240ebe..77aa057b094 100644
--- a/crates/storybook2/src/stories/focus.rs
+++ b/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()
diff --git a/crates/storybook2/src/stories/kitchen_sink.rs b/crates/storybook2/src/stories/kitchen_sink.rs
index f79a27aa89f..271285cc2f5 100644
--- a/crates/storybook2/src/stories/kitchen_sink.rs
+++ b/crates/storybook2/src/stories/kitchen_sink.rs
@@ -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)
}
}
diff --git a/crates/storybook2/src/stories/picker.rs b/crates/storybook2/src/stories/picker.rs
index 80818946f6d..75eb0d88e79 100644
--- a/crates/storybook2/src/stories/picker.rs
+++ b/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();
diff --git a/crates/storybook2/src/stories/scroll.rs b/crates/storybook2/src/stories/scroll.rs
index 9b9a54e1e67..297e65d411d 100644
--- a/crates/storybook2/src/stories/scroll.rs
+++ b/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)
}
}
diff --git a/crates/storybook2/src/stories/text.rs b/crates/storybook2/src/stories/text.rs
index 42009136c41..3cb39aa01a2 100644
--- a/crates/storybook2/src/stories/text.rs
+++ b/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}");
})
)
diff --git a/crates/storybook2/src/stories/z_index.rs b/crates/storybook2/src/stories/z_index.rs
index 9d04d3d81ff..c6a4b68cc36 100644
--- a/crates/storybook2/src/stories/z_index.rs
+++ b/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()
diff --git a/crates/storybook2/src/storybook2.rs b/crates/storybook2/src/storybook2.rs
index 2a62c135b18..e1bb4ef3f46 100644
--- a/crates/storybook2/src/storybook2.rs
+++ b/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()