Cleanups preparing for WindowContext refactor (#22475)

* Remove unnecessary WindowContext and ViewContext '_ lifetimes

* Removed some cases where WindowContext has a different name than `cx`.

Release Notes:

- N/A
This commit is contained in:
Michael Sloan 2024-12-28 14:36:14 -07:00 committed by GitHub
parent 9815358bdd
commit 016b5d60e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
41 changed files with 127 additions and 152 deletions

View file

@ -84,7 +84,7 @@ impl Context for AsyncAppContext {
fn update_window<T, F>(&mut self, window: AnyWindowHandle, f: F) -> Result<T>
where
F: FnOnce(AnyView, &mut WindowContext<'_>) -> T,
F: FnOnce(AnyView, &mut WindowContext) -> T,
{
let app = self.app.upgrade().context("app was released")?;
let mut lock = app.borrow_mut();
@ -349,7 +349,7 @@ impl Context for AsyncWindowContext {
fn update_window<T, F>(&mut self, window: AnyWindowHandle, update: F) -> Result<T>
where
F: FnOnce(AnyView, &mut WindowContext<'_>) -> T,
F: FnOnce(AnyView, &mut WindowContext) -> T,
{
self.app.update_window(window, update)
}
@ -369,7 +369,7 @@ impl Context for AsyncWindowContext {
impl VisualContext for AsyncWindowContext {
fn new_view<V>(
&mut self,
build_view_state: impl FnOnce(&mut ViewContext<'_, V>) -> V,
build_view_state: impl FnOnce(&mut ViewContext<V>) -> V,
) -> Self::Result<View<V>>
where
V: 'static + Render,
@ -381,7 +381,7 @@ impl VisualContext for AsyncWindowContext {
fn update_view<V: 'static, R>(
&mut self,
view: &View<V>,
update: impl FnOnce(&mut V, &mut ViewContext<'_, V>) -> R,
update: impl FnOnce(&mut V, &mut ViewContext<V>) -> R,
) -> Self::Result<R> {
self.window
.update(self, |_, cx| cx.update_view(view, update))
@ -389,7 +389,7 @@ impl VisualContext for AsyncWindowContext {
fn replace_root_view<V>(
&mut self,
build_view: impl FnOnce(&mut ViewContext<'_, V>) -> V,
build_view: impl FnOnce(&mut ViewContext<V>) -> V,
) -> Self::Result<View<V>>
where
V: 'static + Render,