diff --git a/crates/assistant/src/assistant_panel.rs b/crates/assistant/src/assistant_panel.rs index 27fbc7743444a..ebf8326a68e03 100644 --- a/crates/assistant/src/assistant_panel.rs +++ b/crates/assistant/src/assistant_panel.rs @@ -4966,8 +4966,8 @@ fn fold_toggle( ) -> impl Fn( MultiBufferRow, bool, - Arc) + Send + Sync>, - &mut WindowContext<'_>, + Arc, + &mut WindowContext, ) -> AnyElement { move |row, is_folded, fold, _cx| { Disclosure::new((name, row.0 as u64), !is_folded) diff --git a/crates/assistant/src/slash_command_picker.rs b/crates/assistant/src/slash_command_picker.rs index bad56a45a5cbe..102f706c95772 100644 --- a/crates/assistant/src/slash_command_picker.rs +++ b/crates/assistant/src/slash_command_picker.rs @@ -27,8 +27,8 @@ enum SlashCommandEntry { Info(SlashCommandInfo), Advert { name: SharedString, - renderer: fn(&mut WindowContext<'_>) -> AnyElement, - on_confirm: fn(&mut WindowContext<'_>), + renderer: fn(&mut WindowContext) -> AnyElement, + on_confirm: fn(&mut WindowContext), }, } diff --git a/crates/editor/src/clangd_ext.rs b/crates/editor/src/clangd_ext.rs index c018362068680..28aafc1f46c9f 100644 --- a/crates/editor/src/clangd_ext.rs +++ b/crates/editor/src/clangd_ext.rs @@ -16,7 +16,7 @@ fn is_c_language(language: &Language) -> bool { pub fn switch_source_header( editor: &mut Editor, _: &SwitchSourceHeader, - cx: &mut ViewContext<'_, Editor>, + cx: &mut ViewContext, ) { let Some(project) = &editor.project else { return; diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index bddcc631f103f..8c6132d0a9439 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -3513,7 +3513,7 @@ impl Editor { } } - fn visible_inlay_hints(&self, cx: &ViewContext<'_, Editor>) -> Vec { + fn visible_inlay_hints(&self, cx: &ViewContext) -> Vec { self.display_map .read(cx) .current_inlays() @@ -6009,7 +6009,7 @@ impl Editor { fn gather_revert_changes( &mut self, selections: &[Selection], - cx: &mut ViewContext<'_, Editor>, + cx: &mut ViewContext, ) -> HashMap, Rope)>> { let mut revert_changes = HashMap::default(); let snapshot = self.snapshot(cx); @@ -8936,7 +8936,7 @@ impl Editor { fn templates_with_tags( project: &Model, runnable: &mut Runnable, - cx: &WindowContext<'_>, + cx: &WindowContext, ) -> Vec<(TaskSourceKind, TaskTemplate)> { let (inventory, worktree_id, file) = project.read_with(cx, |project, cx| { let (worktree_id, file) = project @@ -9248,7 +9248,7 @@ impl Editor { &mut self, snapshot: &EditorSnapshot, position: Point, - cx: &mut ViewContext<'_, Editor>, + cx: &mut ViewContext, ) -> Option { for (ix, position) in [position, Point::zero()].into_iter().enumerate() { if let Some(hunk) = self.go_to_next_hunk_in_direction( @@ -9277,7 +9277,7 @@ impl Editor { &mut self, snapshot: &EditorSnapshot, position: Point, - cx: &mut ViewContext<'_, Editor>, + cx: &mut ViewContext, ) -> Option { for (ix, position) in [position, snapshot.buffer_snapshot.max_point()] .into_iter() @@ -13842,7 +13842,7 @@ impl SemanticsProvider for Model { fn inlay_hint_settings( location: Anchor, snapshot: &MultiBufferSnapshot, - cx: &mut ViewContext<'_, Editor>, + cx: &mut ViewContext, ) -> InlayHintSettings { let file = snapshot.file_at(location); let language = snapshot.language_at(location).map(|l| l.name()); diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index af89945f4f0d1..379b16c09b6d7 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -4991,7 +4991,7 @@ fn jump_data( block_row_start: DisplayRow, height: u32, for_excerpt: &ExcerptInfo, - cx: &mut WindowContext<'_>, + cx: &mut WindowContext, ) -> JumpData { let range = &for_excerpt.range; let buffer = &for_excerpt.buffer; @@ -5066,7 +5066,7 @@ fn prepaint_gutter_button( scroll_pixel_position: gpui::Point, gutter_hitbox: &Hitbox, rows_with_hunk_bounds: &HashMap>, - cx: &mut WindowContext<'_>, + cx: &mut WindowContext, ) -> AnyElement { let mut button = button.into_any_element(); let available_space = size( @@ -5099,7 +5099,7 @@ fn render_inline_blame_entry( blame_entry: BlameEntry, style: &EditorStyle, workspace: Option>, - cx: &mut WindowContext<'_>, + cx: &mut WindowContext, ) -> AnyElement { let relative_timestamp = blame_entry_relative_timestamp(&blame_entry); @@ -5139,7 +5139,7 @@ fn render_blame_entry( style: &EditorStyle, last_used_color: &mut Option<(PlayerColor, Oid)>, editor: View, - cx: &mut WindowContext<'_>, + cx: &mut WindowContext, ) -> AnyElement { let mut sha_color = cx .theme() @@ -5221,7 +5221,7 @@ fn deploy_blame_entry_context_menu( details: Option<&CommitDetails>, editor: View, position: gpui::Point, - cx: &mut WindowContext<'_>, + cx: &mut WindowContext, ) { let context_menu = ContextMenu::build(cx, move |menu, _| { let sha = format!("{}", blame_entry.sha); diff --git a/crates/editor/src/hover_links.rs b/crates/editor/src/hover_links.rs index 75218ff1c8bfe..9d51eb7175103 100644 --- a/crates/editor/src/hover_links.rs +++ b/crates/editor/src/hover_links.rs @@ -266,7 +266,7 @@ pub fn update_inlay_link_and_hover_points( editor: &mut Editor, secondary_held: bool, shift_held: bool, - cx: &mut ViewContext<'_, Editor>, + cx: &mut ViewContext, ) { let hovered_offset = if point_for_position.column_overshoot_after_line_end == 0 { Some(snapshot.display_point_to_inlay_offset(point_for_position.exact_unclipped, Bias::Left)) diff --git a/crates/editor/src/hunk_diff.rs b/crates/editor/src/hunk_diff.rs index 748aa3bd87adc..13dde1277375f 100644 --- a/crates/editor/src/hunk_diff.rs +++ b/crates/editor/src/hunk_diff.rs @@ -365,7 +365,7 @@ impl Editor { &mut self, diff_base_buffer: Option>, hunk: &HoveredHunk, - cx: &mut ViewContext<'_, Editor>, + cx: &mut ViewContext, ) -> Option<()> { let buffer = self.buffer.clone(); let multi_buffer_snapshot = buffer.read(cx).snapshot(cx); @@ -454,7 +454,7 @@ impl Editor { fn apply_diff_hunks_in_range( &mut self, range: Range, - cx: &mut ViewContext<'_, Editor>, + cx: &mut ViewContext, ) -> Option<()> { let (buffer, range, _) = self .buffer @@ -530,7 +530,7 @@ impl Editor { fn hunk_header_block( &self, hunk: &HoveredHunk, - cx: &mut ViewContext<'_, Editor>, + cx: &mut ViewContext, ) -> BlockProperties { let is_branch_buffer = self .buffer @@ -801,7 +801,7 @@ impl Editor { hunk: &HoveredHunk, diff_base_buffer: Model, deleted_text_height: u32, - cx: &mut ViewContext<'_, Editor>, + cx: &mut ViewContext, ) -> BlockProperties { let gutter_color = match hunk.status { DiffHunkStatus::Added => unreachable!(), @@ -864,7 +864,7 @@ impl Editor { } } - pub(super) fn clear_expanded_diff_hunks(&mut self, cx: &mut ViewContext<'_, Editor>) -> bool { + pub(super) fn clear_expanded_diff_hunks(&mut self, cx: &mut ViewContext) -> bool { if self.diff_map.expand_all { return false; } @@ -887,7 +887,7 @@ impl Editor { pub(super) fn sync_expanded_diff_hunks( diff_map: &mut DiffMap, buffer_id: BufferId, - cx: &mut ViewContext<'_, Self>, + cx: &mut ViewContext, ) { let diff_base_state = diff_map.diff_bases.get_mut(&buffer_id); let mut diff_base_buffer = None; @@ -1134,7 +1134,7 @@ fn editor_with_deleted_text( diff_base_buffer: Model, deleted_color: Hsla, hunk: &HoveredHunk, - cx: &mut ViewContext<'_, Editor>, + cx: &mut ViewContext, ) -> (u32, View) { let parent_editor = cx.view().downgrade(); let editor = cx.new_view(|cx| { diff --git a/crates/editor/src/inlay_hint_cache.rs b/crates/editor/src/inlay_hint_cache.rs index e7c97cbf09c44..9c0d3d1bc288a 100644 --- a/crates/editor/src/inlay_hint_cache.rs +++ b/crates/editor/src/inlay_hint_cache.rs @@ -579,7 +579,7 @@ impl InlayHintCache { buffer_id: BufferId, excerpt_id: ExcerptId, id: InlayId, - cx: &mut ViewContext<'_, Editor>, + cx: &mut ViewContext, ) { if let Some(excerpt_hints) = self.hints.get(&excerpt_id) { let mut guard = excerpt_hints.write(); @@ -640,7 +640,7 @@ fn spawn_new_update_tasks( excerpts_to_query: HashMap, Global, Range)>, invalidate: InvalidationStrategy, update_cache_version: usize, - cx: &mut ViewContext<'_, Editor>, + cx: &mut ViewContext, ) { for (excerpt_id, (excerpt_buffer, new_task_buffer_version, excerpt_visible_range)) in excerpts_to_query @@ -797,7 +797,7 @@ fn new_update_task( query: ExcerptQuery, query_ranges: QueryRanges, excerpt_buffer: Model, - cx: &mut ViewContext<'_, Editor>, + cx: &mut ViewContext, ) -> Task<()> { cx.spawn(move |editor, mut cx| async move { let visible_range_update_results = future::join_all( @@ -1129,7 +1129,7 @@ fn apply_hint_update( invalidate: bool, buffer_snapshot: BufferSnapshot, multi_buffer_snapshot: MultiBufferSnapshot, - cx: &mut ViewContext<'_, Editor>, + cx: &mut ViewContext, ) { let cached_excerpt_hints = editor .inlay_hint_cache @@ -3434,7 +3434,7 @@ pub mod tests { labels } - pub fn visible_hint_labels(editor: &Editor, cx: &ViewContext<'_, Editor>) -> Vec { + pub fn visible_hint_labels(editor: &Editor, cx: &ViewContext) -> Vec { let mut hints = editor .visible_inlay_hints(cx) .into_iter() diff --git a/crates/editor/src/rust_analyzer_ext.rs b/crates/editor/src/rust_analyzer_ext.rs index ba14f91ed2935..8885f6062e3d6 100644 --- a/crates/editor/src/rust_analyzer_ext.rs +++ b/crates/editor/src/rust_analyzer_ext.rs @@ -33,7 +33,7 @@ pub fn apply_related_actions(editor: &View, cx: &mut WindowContext) { pub fn expand_macro_recursively( editor: &mut Editor, _: &ExpandMacroRecursively, - cx: &mut ViewContext<'_, Editor>, + cx: &mut ViewContext, ) { if editor.selections.count() == 0 { return; @@ -98,7 +98,7 @@ pub fn expand_macro_recursively( .detach_and_log_err(cx); } -pub fn open_docs(editor: &mut Editor, _: &OpenDocs, cx: &mut ViewContext<'_, Editor>) { +pub fn open_docs(editor: &mut Editor, _: &OpenDocs, cx: &mut ViewContext) { if editor.selections.count() == 0 { return; } diff --git a/crates/editor/src/tasks.rs b/crates/editor/src/tasks.rs index 51945a1780335..4e2cccea02c04 100644 --- a/crates/editor/src/tasks.rs +++ b/crates/editor/src/tasks.rs @@ -8,7 +8,7 @@ use workspace::Workspace; fn task_context_with_editor( editor: &mut Editor, - cx: &mut WindowContext<'_>, + cx: &mut WindowContext, ) -> AsyncTask> { let Some(project) = editor.project.clone() else { return AsyncTask::ready(None); @@ -74,7 +74,7 @@ fn task_context_with_editor( }) } -pub fn task_context(workspace: &Workspace, cx: &mut WindowContext<'_>) -> AsyncTask { +pub fn task_context(workspace: &Workspace, cx: &mut WindowContext) -> AsyncTask { let Some(editor) = workspace .active_item(cx) .and_then(|item| item.act_as::(cx)) diff --git a/crates/extensions_ui/src/extensions_ui.rs b/crates/extensions_ui/src/extensions_ui.rs index ac9efa1a64927..0ed79c250b5af 100644 --- a/crates/extensions_ui/src/extensions_ui.rs +++ b/crates/extensions_ui/src/extensions_ui.rs @@ -843,7 +843,7 @@ impl ExtensionsPage { } } - fn fetch_extensions_debounced(&mut self, cx: &mut ViewContext<'_, ExtensionsPage>) { + fn fetch_extensions_debounced(&mut self, cx: &mut ViewContext) { self.extension_fetch_task = Some(cx.spawn(|this, mut cx| async move { let search = this .update(&mut cx, |this, cx| this.search_query(cx)) diff --git a/crates/file_finder/src/file_finder.rs b/crates/file_finder/src/file_finder.rs index 55c02c87af97b..c5c620b4f4f49 100644 --- a/crates/file_finder/src/file_finder.rs +++ b/crates/file_finder/src/file_finder.rs @@ -884,7 +884,7 @@ impl FileFinderDelegate { fn lookup_absolute_path( &self, query: FileSearchQuery, - cx: &mut ViewContext<'_, Picker>, + cx: &mut ViewContext>, ) -> Task<()> { cx.spawn(|picker, mut cx| async move { let Some(project) = picker diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs index 7c67b5df87ebf..208971763db3a 100644 --- a/crates/git_ui/src/git_panel.rs +++ b/crates/git_ui/src/git_panel.rs @@ -1044,7 +1044,7 @@ impl GitPanel { hunks: Rc>>, change_focus: bool, debounce: Option, - cx: &mut ViewContext<'_, Self>, + cx: &mut ViewContext, ) { let workspace = self.workspace.clone(); let Some(diff_editor) = self.git_diff_editor.clone() else { diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index 33cabc000f47a..db5036102b111 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -1490,7 +1490,7 @@ impl Context for AppContext { fn update_window(&mut self, handle: AnyWindowHandle, update: F) -> Result where - F: FnOnce(AnyView, &mut WindowContext<'_>) -> T, + F: FnOnce(AnyView, &mut WindowContext) -> T, { self.update(|cx| { let mut window = cx diff --git a/crates/gpui/src/app/async_context.rs b/crates/gpui/src/app/async_context.rs index be35776595714..c24ebc29bc46e 100644 --- a/crates/gpui/src/app/async_context.rs +++ b/crates/gpui/src/app/async_context.rs @@ -84,7 +84,7 @@ impl Context for AsyncAppContext { fn update_window(&mut self, window: AnyWindowHandle, f: F) -> Result 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(&mut self, window: AnyWindowHandle, update: F) -> Result 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( &mut self, - build_view_state: impl FnOnce(&mut ViewContext<'_, V>) -> V, + build_view_state: impl FnOnce(&mut ViewContext) -> V, ) -> Self::Result> where V: 'static + Render, @@ -381,7 +381,7 @@ impl VisualContext for AsyncWindowContext { fn update_view( &mut self, view: &View, - update: impl FnOnce(&mut V, &mut ViewContext<'_, V>) -> R, + update: impl FnOnce(&mut V, &mut ViewContext) -> R, ) -> Self::Result { self.window .update(self, |_, cx| cx.update_view(view, update)) @@ -389,7 +389,7 @@ impl VisualContext for AsyncWindowContext { fn replace_root_view( &mut self, - build_view: impl FnOnce(&mut ViewContext<'_, V>) -> V, + build_view: impl FnOnce(&mut ViewContext) -> V, ) -> Self::Result> where V: 'static + Render, diff --git a/crates/gpui/src/app/model_context.rs b/crates/gpui/src/app/model_context.rs index d3f07b25ebaa2..25b68fbdd5d77 100644 --- a/crates/gpui/src/app/model_context.rs +++ b/crates/gpui/src/app/model_context.rs @@ -263,7 +263,7 @@ impl<'a, T> Context for ModelContext<'a, T> { fn update_window(&mut self, window: AnyWindowHandle, update: F) -> Result where - F: FnOnce(AnyView, &mut WindowContext<'_>) -> R, + F: FnOnce(AnyView, &mut WindowContext) -> R, { self.app.update_window(window, update) } diff --git a/crates/gpui/src/app/test_context.rs b/crates/gpui/src/app/test_context.rs index 04ca7764c5bf2..f371648f75679 100644 --- a/crates/gpui/src/app/test_context.rs +++ b/crates/gpui/src/app/test_context.rs @@ -77,7 +77,7 @@ impl Context for TestAppContext { fn update_window(&mut self, window: AnyWindowHandle, f: F) -> Result where - F: FnOnce(AnyView, &mut WindowContext<'_>) -> T, + F: FnOnce(AnyView, &mut WindowContext) -> T, { let mut lock = self.app.borrow_mut(); lock.update_window(window, f) @@ -916,7 +916,7 @@ impl Context for VisualTestContext { fn update_window(&mut self, window: AnyWindowHandle, f: F) -> Result where - F: FnOnce(AnyView, &mut WindowContext<'_>) -> T, + F: FnOnce(AnyView, &mut WindowContext) -> T, { self.cx.update_window(window, f) } @@ -936,7 +936,7 @@ impl Context for VisualTestContext { impl VisualContext for VisualTestContext { fn new_view( &mut self, - build_view: impl FnOnce(&mut ViewContext<'_, V>) -> V, + build_view: impl FnOnce(&mut ViewContext) -> V, ) -> Self::Result> where V: 'static + Render, @@ -949,7 +949,7 @@ impl VisualContext for VisualTestContext { fn update_view( &mut self, view: &View, - update: impl FnOnce(&mut V, &mut ViewContext<'_, V>) -> R, + update: impl FnOnce(&mut V, &mut ViewContext) -> R, ) -> Self::Result { self.window .update(&mut self.cx, |_, cx| cx.update_view(view, update)) @@ -958,7 +958,7 @@ impl VisualContext for VisualTestContext { fn replace_root_view( &mut self, - build_view: impl FnOnce(&mut ViewContext<'_, V>) -> V, + build_view: impl FnOnce(&mut ViewContext) -> V, ) -> Self::Result> where V: 'static + Render, @@ -993,7 +993,7 @@ impl AnyWindowHandle { pub fn build_view( &self, cx: &mut TestAppContext, - build_view: impl FnOnce(&mut ViewContext<'_, V>) -> V, + build_view: impl FnOnce(&mut ViewContext) -> V, ) -> View { self.update(cx, |_, cx| cx.new_view(build_view)).unwrap() } diff --git a/crates/gpui/src/elements/div.rs b/crates/gpui/src/elements/div.rs index 3f826ca00790b..36f42c137c1f9 100644 --- a/crates/gpui/src/elements/div.rs +++ b/crates/gpui/src/elements/div.rs @@ -2499,7 +2499,7 @@ impl ScrollAnchor { } } /// Request scroll to this item on the next frame. - pub fn scroll_to(&self, cx: &mut WindowContext<'_>) { + pub fn scroll_to(&self, cx: &mut WindowContext) { let this = self.clone(); cx.on_next_frame(move |_| { diff --git a/crates/gpui/src/elements/text.rs b/crates/gpui/src/elements/text.rs index 427097d1b7acb..caa0c605d6605 100644 --- a/crates/gpui/src/elements/text.rs +++ b/crates/gpui/src/elements/text.rs @@ -472,9 +472,9 @@ pub struct InteractiveText { element_id: ElementId, text: StyledText, click_listener: - Option], InteractiveTextClickEvent, &mut WindowContext<'_>)>>, - hover_listener: Option, MouseMoveEvent, &mut WindowContext<'_>)>>, - tooltip_builder: Option) -> Option>>, + Option], InteractiveTextClickEvent, &mut WindowContext)>>, + hover_listener: Option, MouseMoveEvent, &mut WindowContext)>>, + tooltip_builder: Option Option>>, clickable_ranges: Vec>, } @@ -510,7 +510,7 @@ impl InteractiveText { pub fn on_click( mut self, ranges: Vec>, - listener: impl Fn(usize, &mut WindowContext<'_>) + 'static, + listener: impl Fn(usize, &mut WindowContext) + 'static, ) -> Self { self.click_listener = Some(Box::new(move |ranges, event, cx| { for (range_ix, range) in ranges.iter().enumerate() { @@ -528,7 +528,7 @@ impl InteractiveText { /// index of the hovered character, or None if the mouse leaves the text. pub fn on_hover( mut self, - listener: impl Fn(Option, MouseMoveEvent, &mut WindowContext<'_>) + 'static, + listener: impl Fn(Option, MouseMoveEvent, &mut WindowContext) + 'static, ) -> Self { self.hover_listener = Some(Box::new(listener)); self @@ -537,7 +537,7 @@ impl InteractiveText { /// tooltip lets you specify a tooltip for a given character index in the string. pub fn tooltip( mut self, - builder: impl Fn(usize, &mut WindowContext<'_>) -> Option + 'static, + builder: impl Fn(usize, &mut WindowContext) -> Option + 'static, ) -> Self { self.tooltip_builder = Some(Rc::new(builder)); self diff --git a/crates/gpui/src/gpui.rs b/crates/gpui/src/gpui.rs index 265491c6f5b6c..fd2617f393f9f 100644 --- a/crates/gpui/src/gpui.rs +++ b/crates/gpui/src/gpui.rs @@ -202,7 +202,7 @@ pub trait Context { /// Update a window for the given handle. fn update_window(&mut self, window: AnyWindowHandle, f: F) -> Result where - F: FnOnce(AnyView, &mut WindowContext<'_>) -> T; + F: FnOnce(AnyView, &mut WindowContext) -> T; /// Read a window off of the application context. fn read_window( @@ -231,7 +231,7 @@ pub trait VisualContext: Context { /// Construct a new view in the window referenced by this context. fn new_view( &mut self, - build_view: impl FnOnce(&mut ViewContext<'_, V>) -> V, + build_view: impl FnOnce(&mut ViewContext) -> V, ) -> Self::Result> where V: 'static + Render; @@ -240,13 +240,13 @@ pub trait VisualContext: Context { fn update_view( &mut self, view: &View, - update: impl FnOnce(&mut V, &mut ViewContext<'_, V>) -> R, + update: impl FnOnce(&mut V, &mut ViewContext) -> R, ) -> Self::Result; /// Replace the root view of a window with a new view. fn replace_root_view( &mut self, - build_view: impl FnOnce(&mut ViewContext<'_, V>) -> V, + build_view: impl FnOnce(&mut ViewContext) -> V, ) -> Self::Result> where V: 'static + Render; diff --git a/crates/gpui/src/view.rs b/crates/gpui/src/view.rs index 4f35413a2793a..f28c06044b091 100644 --- a/crates/gpui/src/view.rs +++ b/crates/gpui/src/view.rs @@ -69,7 +69,7 @@ impl View { pub fn update( &self, cx: &mut C, - f: impl FnOnce(&mut V, &mut ViewContext<'_, V>) -> R, + f: impl FnOnce(&mut V, &mut ViewContext) -> R, ) -> C::Result where C: VisualContext, @@ -183,7 +183,7 @@ impl WeakView { pub fn update( &self, cx: &mut C, - f: impl FnOnce(&mut V, &mut ViewContext<'_, V>) -> R, + f: impl FnOnce(&mut V, &mut ViewContext) -> R, ) -> Result where C: VisualContext, diff --git a/crates/language_tools/src/lsp_log.rs b/crates/language_tools/src/lsp_log.rs index 83e85db8888b1..3b96703609923 100644 --- a/crates/language_tools/src/lsp_log.rs +++ b/crates/language_tools/src/lsp_log.rs @@ -703,15 +703,11 @@ impl LspLogView { }); let editor_subscription = cx.subscribe( &editor, - |_, _, event: &EditorEvent, cx: &mut ViewContext<'_, LspLogView>| { - cx.emit(event.clone()) - }, + |_, _, event: &EditorEvent, cx: &mut ViewContext| cx.emit(event.clone()), ); let search_subscription = cx.subscribe( &editor, - |_, _, event: &SearchEvent, cx: &mut ViewContext<'_, LspLogView>| { - cx.emit(event.clone()) - }, + |_, _, event: &SearchEvent, cx: &mut ViewContext| cx.emit(event.clone()), ); (editor, vec![editor_subscription, search_subscription]) } @@ -730,15 +726,11 @@ impl LspLogView { }); let editor_subscription = cx.subscribe( &editor, - |_, _, event: &EditorEvent, cx: &mut ViewContext<'_, LspLogView>| { - cx.emit(event.clone()) - }, + |_, _, event: &EditorEvent, cx: &mut ViewContext| cx.emit(event.clone()), ); let search_subscription = cx.subscribe( &editor, - |_, _, event: &SearchEvent, cx: &mut ViewContext<'_, LspLogView>| { - cx.emit(event.clone()) - }, + |_, _, event: &SearchEvent, cx: &mut ViewContext| cx.emit(event.clone()), ); (editor, vec![editor_subscription, search_subscription]) } diff --git a/crates/language_tools/src/syntax_tree_view.rs b/crates/language_tools/src/syntax_tree_view.rs index a0eb479e6d155..f96dc6a87fb7f 100644 --- a/crates/language_tools/src/syntax_tree_view.rs +++ b/crates/language_tools/src/syntax_tree_view.rs @@ -273,7 +273,7 @@ impl SyntaxTreeView { } impl Render for SyntaxTreeView { - fn render(&mut self, cx: &mut gpui::ViewContext<'_, Self>) -> impl IntoElement { + fn render(&mut self, cx: &mut gpui::ViewContext) -> impl IntoElement { let mut rendered = div().flex_1(); if let Some(layer) = self @@ -422,7 +422,7 @@ impl SyntaxTreeToolbarItemView { } } - fn render_menu(&mut self, cx: &mut ViewContext<'_, Self>) -> Option> { + fn render_menu(&mut self, cx: &mut ViewContext) -> Option> { let tree_view = self.tree_view.as_ref()?; let tree_view = tree_view.read(cx); @@ -492,7 +492,7 @@ fn format_node_range(node: Node) -> String { } impl Render for SyntaxTreeToolbarItemView { - fn render(&mut self, cx: &mut ViewContext<'_, Self>) -> impl IntoElement { + fn render(&mut self, cx: &mut ViewContext) -> impl IntoElement { self.render_menu(cx) .unwrap_or_else(|| PopoverMenu::new("Empty Syntax Tree")) } diff --git a/crates/outline_panel/src/outline_panel.rs b/crates/outline_panel/src/outline_panel.rs index 586ae89a5bb05..6ac58fab152d6 100644 --- a/crates/outline_panel/src/outline_panel.rs +++ b/crates/outline_panel/src/outline_panel.rs @@ -149,7 +149,7 @@ impl SearchState { previous_matches: HashMap, Arc>>, new_matches: Vec>, theme: Arc, - cx: &mut ViewContext<'_, OutlinePanel>, + cx: &mut ViewContext, ) -> Self { let (highlight_search_match_tx, highlight_search_match_rx) = channel::unbounded(); let (notify_tx, notify_rx) = channel::unbounded::<()>(); @@ -1661,7 +1661,7 @@ impl OutlinePanel { } } - fn reveal_entry_for_selection(&mut self, editor: View, cx: &mut ViewContext<'_, Self>) { + fn reveal_entry_for_selection(&mut self, editor: View, cx: &mut ViewContext) { if !self.active || !OutlinePanelSettings::get_global(cx).auto_reveal_entries { return; } @@ -2656,7 +2656,7 @@ impl OutlinePanel { self.clear_previous(cx); let buffer_search_subscription = cx.subscribe( &new_active_editor, - |outline_panel: &mut Self, _, e: &SearchEvent, cx: &mut ViewContext<'_, Self>| { + |outline_panel: &mut Self, _, e: &SearchEvent, cx: &mut ViewContext| { if matches!(e, SearchEvent::MatchesInvalidated) { outline_panel.update_search_matches(cx); }; @@ -2675,7 +2675,7 @@ impl OutlinePanel { self.update_fs_entries(new_active_editor, None, cx); } - fn clear_previous(&mut self, cx: &mut WindowContext<'_>) { + fn clear_previous(&mut self, cx: &mut WindowContext) { self.fs_entries_update_task = Task::ready(()); self.outline_fetch_tasks.clear(); self.cached_entries_update_task = Task::ready(()); @@ -3124,7 +3124,7 @@ impl OutlinePanel { &self, is_singleton: bool, query: Option, - cx: &mut ViewContext<'_, Self>, + cx: &mut ViewContext, ) -> Task<(Vec, Option)> { let project = self.project.clone(); let Some(active_editor) = self.active_editor() else { @@ -4078,7 +4078,7 @@ impl OutlinePanel { query: Option, show_indent_guides: bool, indent_size: f32, - cx: &mut ViewContext<'_, Self>, + cx: &mut ViewContext, ) -> Div { let contents = if self.cached_entries.is_empty() { let header = if self.updating_fs_entries { @@ -4266,7 +4266,7 @@ impl OutlinePanel { v_flex().w_full().flex_1().overflow_hidden().child(contents) } - fn render_filter_footer(&mut self, pinned: bool, cx: &mut ViewContext<'_, Self>) -> Div { + fn render_filter_footer(&mut self, pinned: bool, cx: &mut ViewContext) -> Div { v_flex().flex_none().child(horizontal_separator(cx)).child( h_flex() .p_2() diff --git a/crates/picker/src/head.rs b/crates/picker/src/head.rs index 5ebcaf13a52e9..d91a73b1b3c0e 100644 --- a/crates/picker/src/head.rs +++ b/crates/picker/src/head.rs @@ -16,7 +16,7 @@ pub(crate) enum Head { impl Head { pub fn editor( placeholder_text: Arc, - edit_handler: impl FnMut(&mut V, View, &EditorEvent, &mut ViewContext<'_, V>) + 'static, + edit_handler: impl FnMut(&mut V, View, &EditorEvent, &mut ViewContext) + 'static, cx: &mut ViewContext, ) -> Self { let editor = cx.new_view(|cx| { @@ -29,7 +29,7 @@ impl Head { } pub fn empty( - blur_handler: impl FnMut(&mut V, &mut ViewContext<'_, V>) + 'static, + blur_handler: impl FnMut(&mut V, &mut ViewContext) + 'static, cx: &mut ViewContext, ) -> Self { let head = cx.new_view(EmptyHead::new); diff --git a/crates/picker/src/picker.rs b/crates/picker/src/picker.rs index 1cdb5af1af3a4..c97fceeef3403 100644 --- a/crates/picker/src/picker.rs +++ b/crates/picker/src/picker.rs @@ -425,7 +425,7 @@ impl Picker { self.cancel(&menu::Cancel, cx); } - pub fn refresh_placeholder(&mut self, cx: &mut WindowContext<'_>) { + pub fn refresh_placeholder(&mut self, cx: &mut WindowContext) { match &self.head { Head::Editor(view) => { let placeholder = self.delegate.placeholder_text(cx); @@ -493,7 +493,7 @@ impl Picker { } } - pub fn set_query(&self, query: impl Into>, cx: &mut WindowContext<'_>) { + pub fn set_query(&self, query: impl Into>, cx: &mut WindowContext) { if let Head::Editor(ref editor) = &self.head { editor.update(cx, |editor, cx| { editor.set_text(query, cx); diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index f03bbe8468904..39f1c8a543e06 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -1209,7 +1209,7 @@ impl ProjectPanel { self.remove(false, action.skip_prompt, cx); } - fn remove(&mut self, trash: bool, skip_prompt: bool, cx: &mut ViewContext<'_, ProjectPanel>) { + fn remove(&mut self, trash: bool, skip_prompt: bool, cx: &mut ViewContext) { maybe!({ let items_to_delete = self.disjoint_entries(cx); if items_to_delete.is_empty() { @@ -3705,7 +3705,7 @@ impl ProjectPanel { project: Model, entry_id: ProjectEntryId, skip_ignored: bool, - cx: &mut ViewContext<'_, Self>, + cx: &mut ViewContext, ) { if let Some(worktree) = project.read(cx).worktree_for_entry(entry_id, cx) { let worktree = worktree.read(cx); diff --git a/crates/recent_projects/src/remote_servers.rs b/crates/recent_projects/src/remote_servers.rs index 099fbbf5353f7..b9b0083b93a6b 100644 --- a/crates/recent_projects/src/remote_servers.rs +++ b/crates/recent_projects/src/remote_servers.rs @@ -61,7 +61,7 @@ struct CreateRemoteServer { } impl CreateRemoteServer { - fn new(cx: &mut WindowContext<'_>) -> Self { + fn new(cx: &mut WindowContext) -> Self { let address_editor = cx.new_view(Editor::single_line); address_editor.update(cx, |this, cx| { this.focus_handle(cx).focus(cx); @@ -88,7 +88,7 @@ struct EditNicknameState { } impl EditNicknameState { - fn new(index: usize, cx: &mut WindowContext<'_>) -> Self { + fn new(index: usize, cx: &mut WindowContext) -> Self { let this = Self { index, editor: cx.new_view(Editor::single_line), @@ -264,7 +264,7 @@ struct DefaultState { servers: Vec, } impl DefaultState { - fn new(cx: &WindowContext<'_>) -> Self { + fn new(cx: &WindowContext) -> Self { let handle = ScrollHandle::new(); let scrollbar = ScrollbarState::new(handle.clone()); let add_new_server = NavigableEntry::new(&handle, cx); @@ -309,7 +309,7 @@ enum Mode { } impl Mode { - fn default_mode(cx: &WindowContext<'_>) -> Self { + fn default_mode(cx: &WindowContext) -> Self { Self::Default(DefaultState::new(cx)) } } @@ -1003,7 +1003,7 @@ impl RemoteServerProjects { fn callback( workspace: WeakView, connection_string: SharedString, - cx: &mut WindowContext<'_>, + cx: &mut WindowContext, ) { cx.write_to_clipboard(ClipboardItem::new_string( connection_string.to_string(), @@ -1069,7 +1069,7 @@ impl RemoteServerProjects { remote_servers: View, index: usize, connection_string: SharedString, - cx: &mut WindowContext<'_>, + cx: &mut WindowContext, ) { let prompt_message = format!("Remove server `{}`?", connection_string); diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index 13af840854991..9272d99524792 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -1254,7 +1254,7 @@ impl ProjectSearchView { fn buffer_search_query( workspace: &mut Workspace, item: &dyn ItemHandle, - cx: &mut ViewContext<'_, Workspace>, + cx: &mut ViewContext, ) -> Option { let buffer_search_bar = workspace .pane_for(item) diff --git a/crates/semantic_index/src/project_index_debug_view.rs b/crates/semantic_index/src/project_index_debug_view.rs index d6628064ac0ae..4f59290f021eb 100644 --- a/crates/semantic_index/src/project_index_debug_view.rs +++ b/crates/semantic_index/src/project_index_debug_view.rs @@ -196,7 +196,7 @@ impl ProjectIndexDebugView { } impl Render for ProjectIndexDebugView { - fn render(&mut self, cx: &mut gpui::ViewContext<'_, Self>) -> impl IntoElement { + fn render(&mut self, cx: &mut gpui::ViewContext) -> impl IntoElement { if let Some(selected_path) = self.selected_path.as_ref() { v_flex() .child( diff --git a/crates/tab_switcher/src/tab_switcher.rs b/crates/tab_switcher/src/tab_switcher.rs index 5d02884472eaa..64d9da71fa4f8 100644 --- a/crates/tab_switcher/src/tab_switcher.rs +++ b/crates/tab_switcher/src/tab_switcher.rs @@ -253,7 +253,7 @@ impl TabSwitcherDelegate { fn select_item( &mut self, item_id: EntityId, - cx: &mut ViewContext<'_, Picker>, + cx: &mut ViewContext>, ) { let selected_idx = self .matches @@ -263,7 +263,7 @@ impl TabSwitcherDelegate { self.set_selected_index(selected_idx, cx); } - fn close_item_at(&mut self, ix: usize, cx: &mut ViewContext<'_, Picker>) { + fn close_item_at(&mut self, ix: usize, cx: &mut ViewContext>) { let Some(tab_match) = self.matches.get(ix) else { return; }; diff --git a/crates/tasks_ui/src/lib.rs b/crates/tasks_ui/src/lib.rs index 8616b4266a39b..21625cbe24983 100644 --- a/crates/tasks_ui/src/lib.rs +++ b/crates/tasks_ui/src/lib.rs @@ -105,7 +105,7 @@ fn spawn_task_or_modal(workspace: &mut Workspace, action: &Spawn, cx: &mut ViewC fn toggle_modal( workspace: &mut Workspace, reveal_target: Option, - cx: &mut ViewContext<'_, Workspace>, + cx: &mut ViewContext, ) -> AsyncTask<()> { let task_store = workspace.project().read(cx).task_store().clone(); let workspace_handle = workspace.weak_handle(); diff --git a/crates/terminal_view/src/persistence.rs b/crates/terminal_view/src/persistence.rs index 4e88cb951548f..a3bb2cc522b04 100644 --- a/crates/terminal_view/src/persistence.rs +++ b/crates/terminal_view/src/persistence.rs @@ -143,7 +143,7 @@ fn populate_pane_items( pane: &mut Pane, items: Vec>, active_item: Option, - cx: &mut ViewContext<'_, Pane>, + cx: &mut ViewContext, ) { let mut item_index = pane.items_len(); for item in items { diff --git a/crates/terminal_view/src/terminal_element.rs b/crates/terminal_view/src/terminal_element.rs index 9d5eb7d410648..b984444fbf004 100644 --- a/crates/terminal_view/src/terminal_element.rs +++ b/crates/terminal_view/src/terminal_element.rs @@ -867,7 +867,7 @@ impl Element for TerminalElement { bounds: Bounds, _: &mut Self::RequestLayoutState, layout: &mut Self::PrepaintState, - cx: &mut WindowContext<'_>, + cx: &mut WindowContext, ) { cx.with_content_mask(Some(ContentMask { bounds }), |cx| { let scroll_top = self.terminal_view.read(cx).scroll_top; diff --git a/crates/terminal_view/src/terminal_panel.rs b/crates/terminal_view/src/terminal_panel.rs index b51ed331e63e5..772ed1b80d6e5 100644 --- a/crates/terminal_view/src/terminal_panel.rs +++ b/crates/terminal_view/src/terminal_panel.rs @@ -824,7 +824,7 @@ impl TerminalPanel { task_pane: View, terminal_item_index: usize, terminal_to_replace: View, - cx: &mut ViewContext<'_, Self>, + cx: &mut ViewContext, ) -> Task> { let reveal = spawn_task.reveal; let reveal_target = spawn_task.reveal_target; @@ -1122,7 +1122,7 @@ async fn wait_for_terminals_tasks( let _: Vec<()> = join_all(pending_tasks).await; } -fn add_paths_to_terminal(pane: &mut Pane, paths: &[PathBuf], cx: &mut ViewContext<'_, Pane>) { +fn add_paths_to_terminal(pane: &mut Pane, paths: &[PathBuf], cx: &mut ViewContext) { if let Some(terminal_view) = pane .active_item() .and_then(|item| item.downcast::()) diff --git a/crates/terminal_view/src/terminal_view.rs b/crates/terminal_view/src/terminal_view.rs index 0211661b5b886..ee3fbd8f39abe 100644 --- a/crates/terminal_view/src/terminal_view.rs +++ b/crates/terminal_view/src/terminal_view.rs @@ -606,7 +606,7 @@ impl TerminalView { dispatch_context } - fn set_terminal(&mut self, terminal: Model, cx: &mut ViewContext<'_, TerminalView>) { + fn set_terminal(&mut self, terminal: Model, cx: &mut ViewContext) { self._terminal_subscriptions = subscribe_for_terminal_events(&terminal, self.workspace.clone(), cx); self.terminal = terminal; @@ -616,7 +616,7 @@ impl TerminalView { fn subscribe_for_terminal_events( terminal: &Model, workspace: WeakView, - cx: &mut ViewContext<'_, TerminalView>, + cx: &mut ViewContext, ) -> Vec { let terminal_subscription = cx.observe(terminal, |_, _, cx| cx.notify()); let terminal_events_subscription = diff --git a/crates/title_bar/src/application_menu.rs b/crates/title_bar/src/application_menu.rs index 636af6a6d0ef1..95124300d67e1 100644 --- a/crates/title_bar/src/application_menu.rs +++ b/crates/title_bar/src/application_menu.rs @@ -60,7 +60,7 @@ impl ApplicationMenu { cleaned } - fn build_menu_from_items(entry: MenuEntry, cx: &mut WindowContext<'_>) -> View { + fn build_menu_from_items(entry: MenuEntry, cx: &mut WindowContext) -> View { ContextMenu::build(cx, |menu, cx| { let menu = menu.when_some(cx.focused(), |menu, focused| menu.context(focused)); let sanitized_items = Self::sanitize_menu_items(entry.menu.items); @@ -150,7 +150,7 @@ impl ApplicationMenu { // Defer to prevent focus race condition with the previously open menu let handle = current_handle.clone(); - cx.defer(move |w| handle.show(w)); + cx.defer(move |cx| handle.show(cx)); } }) } diff --git a/crates/ui/src/components/navigable.rs b/crates/ui/src/components/navigable.rs index fadd6d597e003..d4f10fd63a220 100644 --- a/crates/ui/src/components/navigable.rs +++ b/crates/ui/src/components/navigable.rs @@ -18,14 +18,14 @@ pub struct NavigableEntry { impl NavigableEntry { /// Creates a new [NavigableEntry] for a given scroll handle. - pub fn new(scroll_handle: &ScrollHandle, cx: &WindowContext<'_>) -> Self { + pub fn new(scroll_handle: &ScrollHandle, cx: &WindowContext) -> Self { Self { focus_handle: cx.focus_handle(), scroll_anchor: Some(ScrollAnchor::for_handle(scroll_handle.clone())), } } /// Create a new [NavigableEntry] that cannot be scrolled to. - pub fn focusable(cx: &WindowContext<'_>) -> Self { + pub fn focusable(cx: &WindowContext) -> Self { Self { focus_handle: cx.focus_handle(), scroll_anchor: None, @@ -51,7 +51,7 @@ impl Navigable { fn find_focused( selectable_children: &[NavigableEntry], - cx: &mut WindowContext<'_>, + cx: &mut WindowContext, ) -> Option { selectable_children .iter() @@ -59,7 +59,7 @@ impl Navigable { } } impl RenderOnce for Navigable { - fn render(self, _: &mut WindowContext<'_>) -> impl crate::IntoElement { + fn render(self, _: &mut WindowContext) -> impl crate::IntoElement { div() .on_action({ let children = self.selectable_children.clone(); diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index 84bbece6d2629..3f76843181005 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -1942,7 +1942,7 @@ impl Pane { } } - fn toggle_pin_tab(&mut self, _: &TogglePinTab, cx: &mut ViewContext<'_, Self>) { + fn toggle_pin_tab(&mut self, _: &TogglePinTab, cx: &mut ViewContext) { if self.items.is_empty() { return; } @@ -1954,7 +1954,7 @@ impl Pane { } } - fn pin_tab_at(&mut self, ix: usize, cx: &mut ViewContext<'_, Self>) { + fn pin_tab_at(&mut self, ix: usize, cx: &mut ViewContext) { maybe!({ let pane = cx.view().clone(); let destination_index = self.pinned_tab_count.min(ix); @@ -1971,7 +1971,7 @@ impl Pane { }); } - fn unpin_tab_at(&mut self, ix: usize, cx: &mut ViewContext<'_, Self>) { + fn unpin_tab_at(&mut self, ix: usize, cx: &mut ViewContext) { maybe!({ let pane = cx.view().clone(); self.pinned_tab_count = self.pinned_tab_count.checked_sub(1)?; @@ -2003,7 +2003,7 @@ impl Pane { item: &dyn ItemHandle, detail: usize, focus_handle: &FocusHandle, - cx: &mut ViewContext<'_, Pane>, + cx: &mut ViewContext, ) -> impl IntoElement { let is_active = ix == self.active_item_index; let is_preview = self @@ -2416,7 +2416,7 @@ impl Pane { }) } - fn render_tab_bar(&mut self, cx: &mut ViewContext<'_, Pane>) -> impl IntoElement { + fn render_tab_bar(&mut self, cx: &mut ViewContext) -> impl IntoElement { let focus_handle = self.focus_handle.clone(); let navigate_backward = IconButton::new("navigate_backward", IconName::ArrowLeft) .icon_size(IconSize::Small) @@ -2592,12 +2592,7 @@ impl Pane { } } - fn handle_tab_drop( - &mut self, - dragged_tab: &DraggedTab, - ix: usize, - cx: &mut ViewContext<'_, Self>, - ) { + fn handle_tab_drop(&mut self, dragged_tab: &DraggedTab, ix: usize, cx: &mut ViewContext) { if let Some(custom_drop_handle) = self.custom_drop_handle.clone() { if let ControlFlow::Break(()) = custom_drop_handle(self, dragged_tab, cx) { return; @@ -2663,7 +2658,7 @@ impl Pane { &mut self, dragged_selection: &DraggedSelection, dragged_onto: Option, - cx: &mut ViewContext<'_, Self>, + cx: &mut ViewContext, ) { if let Some(custom_drop_handle) = self.custom_drop_handle.clone() { if let ControlFlow::Break(()) = custom_drop_handle(self, dragged_selection, cx) { @@ -2681,7 +2676,7 @@ impl Pane { &mut self, project_entry_id: &ProjectEntryId, target: Option, - cx: &mut ViewContext<'_, Self>, + cx: &mut ViewContext, ) { if let Some(custom_drop_handle) = self.custom_drop_handle.clone() { if let ControlFlow::Break(()) = custom_drop_handle(self, project_entry_id, cx) { @@ -2746,11 +2741,7 @@ impl Pane { .log_err(); } - fn handle_external_paths_drop( - &mut self, - paths: &ExternalPaths, - cx: &mut ViewContext<'_, Self>, - ) { + fn handle_external_paths_drop(&mut self, paths: &ExternalPaths, cx: &mut ViewContext) { if let Some(custom_drop_handle) = self.custom_drop_handle.clone() { if let ControlFlow::Break(()) = custom_drop_handle(self, paths, cx) { return; diff --git a/crates/workspace/src/tasks.rs b/crates/workspace/src/tasks.rs index 33b3c1fa8045c..c01e2ae52be32 100644 --- a/crates/workspace/src/tasks.rs +++ b/crates/workspace/src/tasks.rs @@ -11,7 +11,7 @@ pub fn schedule_task( task_to_resolve: &TaskTemplate, task_cx: &TaskContext, omit_history: bool, - cx: &mut ViewContext<'_, Workspace>, + cx: &mut ViewContext, ) { match workspace.project.read(cx).ssh_connection_state(cx) { None | Some(ConnectionState::Connected) => {} @@ -44,7 +44,7 @@ pub fn schedule_resolved_task( task_source_kind: TaskSourceKind, mut resolved_task: ResolvedTask, omit_history: bool, - cx: &mut ViewContext<'_, Workspace>, + cx: &mut ViewContext, ) { if let Some(spawn_in_terminal) = resolved_task.resolved.take() { if !omit_history { diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 8c724351b4a5d..d27ba72b7a4e5 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -1706,11 +1706,11 @@ impl Workspace { cx.defer(|cx| { cx.windows().iter().find(|window| { window - .update(cx, |_, window| { - if window.is_window_active() { + .update(cx, |_, cx| { + if cx.is_window_active() { //This can only get called when the window's project connection has been lost //so we don't need to prompt the user for anything and instead just close the window - window.remove_window(); + cx.remove_window(); true } else { false @@ -4561,7 +4561,7 @@ impl Workspace { div } - pub fn has_active_modal(&self, cx: &WindowContext<'_>) -> bool { + pub fn has_active_modal(&self, cx: &WindowContext) -> bool { self.modal_layer.read(cx).has_active_modal() } @@ -5018,7 +5018,7 @@ impl Render for Workspace { fn resize_bottom_dock( new_size: Pixels, workspace: &mut Workspace, - cx: &mut ViewContext<'_, Workspace>, + cx: &mut ViewContext, ) { let size = new_size.min(workspace.bounds.bottom() - RESIZE_HANDLE_SIZE); workspace.bottom_dock.update(cx, |bottom_dock, cx| { @@ -5026,22 +5026,14 @@ fn resize_bottom_dock( }); } -fn resize_right_dock( - new_size: Pixels, - workspace: &mut Workspace, - cx: &mut ViewContext<'_, Workspace>, -) { +fn resize_right_dock(new_size: Pixels, workspace: &mut Workspace, cx: &mut ViewContext) { let size = new_size.max(workspace.bounds.left() - RESIZE_HANDLE_SIZE); workspace.right_dock.update(cx, |right_dock, cx| { right_dock.resize_active_panel(Some(size), cx); }); } -fn resize_left_dock( - new_size: Pixels, - workspace: &mut Workspace, - cx: &mut ViewContext<'_, Workspace>, -) { +fn resize_left_dock(new_size: Pixels, workspace: &mut Workspace, cx: &mut ViewContext) { let size = new_size.min(workspace.bounds.right() - RESIZE_HANDLE_SIZE); workspace.left_dock.update(cx, |left_dock, cx| { @@ -6149,7 +6141,7 @@ fn resize_edge( } } -fn join_pane_into_active(active_pane: &View, pane: &View, cx: &mut WindowContext<'_>) { +fn join_pane_into_active(active_pane: &View, pane: &View, cx: &mut WindowContext) { if pane == active_pane { return; } else if pane.read(cx).items_len() == 0 { @@ -6163,7 +6155,7 @@ fn join_pane_into_active(active_pane: &View, pane: &View, cx: &mut W } } -fn move_all_items(from_pane: &View, to_pane: &View, cx: &mut WindowContext<'_>) { +fn move_all_items(from_pane: &View, to_pane: &View, cx: &mut WindowContext) { let destination_is_different = from_pane != to_pane; let mut moved_items = 0; for (item_ix, item_handle) in from_pane @@ -6195,7 +6187,7 @@ pub fn move_item( destination: &View, item_id_to_move: EntityId, destination_index: usize, - cx: &mut WindowContext<'_>, + cx: &mut WindowContext, ) { let Some((item_ix, item_handle)) = source .read(cx) @@ -6227,7 +6219,7 @@ pub fn move_active_item( destination: &View, focus_destination: bool, close_if_empty: bool, - cx: &mut WindowContext<'_>, + cx: &mut WindowContext, ) { if source == destination { return;