Checkpoint - No warnings

This commit is contained in:
Nathan Sobo 2023-09-27 23:10:22 -06:00
parent 1ee70a0146
commit 769a04517f
3 changed files with 15 additions and 46 deletions

View File

@ -62,7 +62,7 @@ impl<S: Send + Sync + 'static, P: Send + 'static> Element for View<S, P> {
fn paint( fn paint(
&mut self, &mut self,
layout: Layout, _: Layout,
_: &mut Self::State, _: &mut Self::State,
element: &mut Self::FrameState, element: &mut Self::FrameState,
cx: &mut ViewContext<Self::State>, cx: &mut ViewContext<Self::State>,
@ -92,12 +92,7 @@ impl<S: Send + Sync + 'static, P: Send + 'static> ViewObject for View<S, P> {
}) })
} }
fn paint( fn paint(&mut self, _: Layout, element: &mut dyn Any, cx: &mut WindowContext) -> Result<()> {
&mut self,
layout: Layout,
element: &mut dyn Any,
cx: &mut WindowContext,
) -> Result<()> {
self.state.update(cx, |state, cx| { self.state.update(cx, |state, cx| {
element element
.downcast_mut::<AnyElement<S>>() .downcast_mut::<AnyElement<S>>()

View File

@ -89,12 +89,12 @@ impl<'a, 'w> WindowContext<'a, 'w> {
} }
} }
pub(crate) fn immutable(app: &'a AppContext, window: &'w Window) -> Self { // pub(crate) fn immutable(app: &'a AppContext, window: &'w Window) -> Self {
Self { // Self {
app: Reference::Immutable(app), // app: Reference::Immutable(app),
window: Reference::Immutable(window), // window: Reference::Immutable(window),
} // }
} // }
pub(crate) fn draw(&mut self) -> Result<()> { pub(crate) fn draw(&mut self) -> Result<()> {
let unit_entity = self.unit_entity.clone(); let unit_entity = self.unit_entity.clone();
@ -204,18 +204,6 @@ impl<'a, 'w> WindowContext<'a, 'w> {
pub fn mouse_position(&self) -> Point<Pixels> { pub fn mouse_position(&self) -> Point<Pixels> {
self.window.mouse_position self.window.mouse_position
} }
fn update_window<R>(
&mut self,
window_handle: AnyWindowHandle,
update: impl FnOnce(&mut WindowContext) -> R,
) -> Result<R> {
if window_handle == self.window.handle {
Ok(update(self))
} else {
self.app.update_window(window_handle.id, update)
}
}
} }
impl Context for WindowContext<'_, '_> { impl Context for WindowContext<'_, '_> {
@ -280,19 +268,6 @@ pub struct ViewContext<'a, 'w, T> {
} }
impl<'a, 'w, T: Send + Sync + 'static> ViewContext<'a, 'w, T> { impl<'a, 'w, T: Send + Sync + 'static> ViewContext<'a, 'w, T> {
// fn update<R>(&mut self, update: impl FnOnce(&mut T, &mut Self) -> R) -> R {
// self.window_cx.update_entity(handle, update)
// let mut entity = self.window_cx.app.entities.remove(&self.entity_id).unwrap();
// let result = update(entity.downcast_mut::<T>().unwrap(), self);
// self.window_cx
// .app
// .entities
// .insert(self.entity_id, Box::new(entity));
// result
// }
fn mutable(app: &'a mut AppContext, window: &'w mut Window, entity_id: EntityId) -> Self { fn mutable(app: &'a mut AppContext, window: &'w mut Window, entity_id: EntityId) -> Self {
Self { Self {
window_cx: WindowContext::mutable(app, window), window_cx: WindowContext::mutable(app, window),
@ -301,13 +276,13 @@ impl<'a, 'w, T: Send + Sync + 'static> ViewContext<'a, 'w, T> {
} }
} }
fn immutable(app: &'a AppContext, window: &'w Window, entity_id: EntityId) -> Self { // fn immutable(app: &'a AppContext, window: &'w Window, entity_id: EntityId) -> Self {
Self { // Self {
window_cx: WindowContext::immutable(app, window), // window_cx: WindowContext::immutable(app, window),
entity_id, // entity_id,
entity_type: PhantomData, // entity_type: PhantomData,
} // }
} // }
pub fn erase_state<R>(&mut self, f: impl FnOnce(&mut ViewContext<()>) -> R) -> R { pub fn erase_state<R>(&mut self, f: impl FnOnce(&mut ViewContext<()>) -> R) -> R {
let entity_id = self.unit_entity.id; let entity_id = self.unit_entity.id;

View File

@ -291,7 +291,6 @@ impl Titlebar {
// ================================================================================ // // ================================================================================ //
mod statusbar { mod statusbar {
use gpui3::WindowContext;
use super::*; use super::*;