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,6 +1,6 @@
use editor::Editor;
use gpui::{
div, Div, IntoElement, ParentElement, Render, Subscription, View, ViewContext, WeakView,
div, Element, IntoElement, ParentElement, Render, Subscription, View, ViewContext, WeakView,
};
use std::sync::Arc;
use ui::{Button, ButtonCommon, Clickable, LabelSize, Tooltip};
@ -38,9 +38,7 @@ impl ActiveBufferLanguage {
}
impl Render for ActiveBufferLanguage {
type Element = Div;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Div {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element {
div().when_some(self.active_language.as_ref(), |el, active_language| {
let active_language_text = if let Some(active_language_text) = active_language {
active_language_text.to_string()

View file

@ -5,7 +5,7 @@ use anyhow::anyhow;
use editor::Editor;
use fuzzy::{match_strings, StringMatch, StringMatchCandidate};
use gpui::{
actions, AppContext, DismissEvent, Div, EventEmitter, FocusHandle, FocusableView, Model,
actions, AppContext, DismissEvent, EventEmitter, FocusHandle, FocusableView, Model,
ParentElement, Render, Styled, View, ViewContext, VisualContext, WeakView,
};
use language::{Buffer, LanguageRegistry};
@ -67,9 +67,7 @@ impl LanguageSelector {
}
impl Render for LanguageSelector {
type Element = Div;
fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
fn render(&mut self, _cx: &mut ViewContext<Self>) -> impl Element {
v_stack().w(rems(34.)).child(self.picker.clone())
}
}