Attempt to return impl Element from render. 3 errors.

This commit is contained in:
Nathan Sobo 2023-12-30 08:58:07 -07:00 committed by Piotr Osiewicz
parent 5f2bb82ef3
commit 51d1d92d66
86 changed files with 230 additions and 443 deletions

View file

@ -1,7 +1,7 @@
use editor::Editor;
use gpui::{
div, white, Div, KeyBinding, ParentElement, Render, Styled, View, ViewContext, VisualContext,
WindowContext,
div, white, Element, KeyBinding, ParentElement, Render, Styled, View, ViewContext,
VisualContext, WindowContext,
};
pub struct AutoHeightEditorStory {
@ -22,9 +22,7 @@ impl AutoHeightEditorStory {
}
impl Render for AutoHeightEditorStory {
type Element = Div;
fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
fn render(&mut self, _cx: &mut ViewContext<Self>) -> impl Element {
div()
.size_full()
.bg(white())

View file

@ -5,9 +5,7 @@ use ui::prelude::*;
pub struct CursorStory;
impl Render for CursorStory {
type Element = Div;
fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
fn render(&mut self, _cx: &mut ViewContext<Self>) -> impl Element {
let all_cursors: [(&str, Box<dyn Fn(Stateful<Div>) -> Stateful<Div>>); 19] = [
(
"cursor_default",

View file

@ -1,6 +1,5 @@
use gpui::{
actions, div, prelude::*, Div, FocusHandle, Focusable, KeyBinding, Render, Stateful,
Subscription, View, WindowContext,
actions, div, prelude::*, FocusHandle, KeyBinding, Render, Subscription, View, WindowContext,
};
use ui::prelude::*;
@ -57,9 +56,7 @@ impl FocusStory {
}
impl Render for FocusStory {
type Element = Focusable<Stateful<Div>>;
fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Self::Element {
fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> impl Element {
let theme = cx.theme();
let color_1 = theme.status().created;
let color_2 = theme.status().modified;

View file

@ -1,4 +1,4 @@
use gpui::{prelude::*, Div, Render, Stateful, View};
use gpui::{prelude::*, Render, View};
use story::Story;
use strum::IntoEnumIterator;
use ui::prelude::*;
@ -14,9 +14,7 @@ impl KitchenSinkStory {
}
impl Render for KitchenSinkStory {
type Element = Stateful<Div>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element {
let component_stories = ComponentStory::iter()
.map(|selector| selector.story(cx))
.collect::<Vec<_>>();

View file

@ -1,4 +1,4 @@
use gpui::{Div, Render};
use gpui::Render;
use story::Story;
use ui::prelude::*;
@ -6,9 +6,7 @@ use ui::prelude::*;
pub struct OverflowScrollStory;
impl Render for OverflowScrollStory {
type Element = Div;
fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
fn render(&mut self, _cx: &mut ViewContext<Self>) -> impl Element {
Story::container()
.child(Story::title("Overflow Scroll"))
.child(Story::label("`overflow_x_scroll`"))

View file

@ -1,7 +1,5 @@
use fuzzy::StringMatchCandidate;
use gpui::{
div, prelude::*, Div, KeyBinding, Render, SharedString, Styled, Task, View, WindowContext,
};
use gpui::{div, prelude::*, KeyBinding, Render, SharedString, Styled, Task, View, WindowContext};
use picker::{Picker, PickerDelegate};
use std::sync::Arc;
use ui::{prelude::*, ListItemSpacing};
@ -202,9 +200,7 @@ impl PickerStory {
}
impl Render for PickerStory {
type Element = Div;
fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Self::Element {
fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> impl Element {
div()
.bg(cx.theme().styles.colors.background)
.size_full()

View file

@ -1,4 +1,4 @@
use gpui::{div, prelude::*, px, Div, Render, SharedString, Stateful, Styled, View, WindowContext};
use gpui::{div, prelude::*, px, Render, SharedString, Styled, View, WindowContext};
use ui::prelude::*;
use ui::Tooltip;
@ -11,9 +11,7 @@ impl ScrollStory {
}
impl Render for ScrollStory {
type Element = Stateful<Div>;
fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Self::Element {
fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> impl Element {
let theme = cx.theme();
let color_1 = theme.status().created;
let color_2 = theme.status().modified;

View file

@ -1,6 +1,6 @@
use gpui::{
div, green, red, Component, HighlightStyle, InteractiveText, IntoElement, ParentElement,
Render, Styled, StyledText, View, VisualContext, WindowContext,
div, green, red, Element, HighlightStyle, InteractiveText, IntoElement, ParentElement, Render,
Styled, StyledText, View, VisualContext, WindowContext,
};
use indoc::indoc;
use story::*;
@ -14,9 +14,7 @@ impl TextStory {
}
impl Render for TextStory {
type Element = Component<StoryContainer>;
fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Self::Element {
fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> impl Element {
StoryContainer::new("Text Story", "crates/storybook2/src/stories/text.rs")
.children(
vec![

View file

@ -1,4 +1,4 @@
use gpui::{Div, Render};
use gpui::Render;
use story::Story;
use ui::prelude::*;
@ -6,9 +6,7 @@ use ui::prelude::*;
pub struct ViewportUnitsStory;
impl Render for ViewportUnitsStory {
type Element = Div;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element {
Story::container().child(
div()
.flex()

View file

@ -7,9 +7,7 @@ use ui::prelude::*;
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>) -> impl Element {
Story::container().child(Story::title("z-index")).child(
div()
.flex()

View file

@ -7,8 +7,8 @@ use std::sync::Arc;
use clap::Parser;
use dialoguer::FuzzySelect;
use gpui::{
div, px, size, AnyView, AppContext, Bounds, Div, Render, ViewContext, VisualContext,
WindowBounds, WindowOptions,
div, px, size, AnyView, AppContext, Bounds, Render, ViewContext, VisualContext, WindowBounds,
WindowOptions,
};
use log::LevelFilter;
use settings2::{default_settings, Settings, SettingsStore};
@ -113,9 +113,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>) -> impl Element {
div()
.flex()
.flex_col()