Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Reduce amount of closure monomorphizations part 2 (#49688)
Lukas Wirthaa91fd4a964b
diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rsindex 32d727962e0..b8af5896285 100644--- a/crates/cli/src/main.rs+++ b/crates/cli/src/main.rs@@ -180,7 +180,7 @@ fn parse_path_with_position(argument_str: &str) -> anyhow::Result<String> {}))}),}- .map(|path_with_pos| path_with_pos.to_string(|path| path.to_string_lossy().into_owned()))+ .map(|path_with_pos| path_with_pos.to_string(&|path| path.to_string_lossy().into_owned()))}fn expand_directory_diff_pairs(@@ -445,7 +445,7 @@ fn parse_path_in_wsl(source: &str, wsl: &str) -> Result<String> {source.path = Path::new(result.trim()).to_owned();- Ok(source.to_string(|path| path.to_string_lossy().into_owned()))+ Ok(source.to_string(&|path| path.to_string_lossy().into_owned()))}fn main() -> Result<()> {diff --git a/crates/debugger_ui/src/debugger_panel.rs b/crates/debugger_ui/src/debugger_panel.rsindex fbc6bb0b632..51b11a24923 100644--- a/crates/debugger_ui/src/debugger_panel.rs+++ b/crates/debugger_ui/src/debugger_panel.rs@@ -515,7 +515,9 @@ impl DebugPanel {}session.update(cx, |session, cx| session.shutdown(cx));this.update(cx, |this, cx| {- this.retain_sessions(|other| entity_id != other.entity_id());+ this.retain_sessions(&|other: &Entity<DebugSession>| {+ entity_id != other.entity_id()+ });if let Some(active_session_id) = this.active_session.as_ref()@@ -1329,7 +1331,7 @@ impl DebugPanel {None}- fn retain_sessions(&mut self, keep: impl Fn(&Entity<DebugSession>) -> bool) {+ fn retain_sessions(&mut self, keep: &dyn Fn(&Entity<DebugSession>) -> bool) {self.sessions_with_children.retain(|session, _| keep(session));for children in self.sessions_with_children.values_mut() {@@ -1464,7 +1466,7 @@ async fn register_session_inner(.keys().find(|p| Some(p.read(cx).session_id(cx)) == session.read(cx).parent_id(cx)).cloned();- this.retain_sessions(|session| {+ this.retain_sessions(&|session: &Entity<DebugSession>| {!session.read(cx).running_state()diff --git a/crates/docs_preprocessor/src/main.rs b/crates/docs_preprocessor/src/main.rsindex 428e90ab3cf..6ef599542a5 100644--- a/crates/docs_preprocessor/src/main.rs+++ b/crates/docs_preprocessor/src/main.rs@@ -303,7 +303,7 @@ fn template_and_validate_json_snippets(book: &mut Book, errors: &mut HashSet<Prefn for_each_labeled_code_block_mut(book: &mut Book,errors: &mut HashSet<PreprocessorError>,- f: impl Fn(&str, &str) -> anyhow::Result<()>,+ f: &dyn Fn(&str, &str) -> anyhow::Result<()>,) {const TAGGED_JSON_BLOCK_START: &'static str = "```json [";const JSON_BLOCK_END: &'static str = "```";@@ -370,7 +370,7 @@ fn template_and_validate_json_snippets(book: &mut Book, errors: &mut HashSet<Pre});}- for_each_labeled_code_block_mut(book, errors, |label, snippet_json| {+ for_each_labeled_code_block_mut(book, errors, &|label, snippet_json| {let mut snippet_json_fixed = snippet_json.to_string().replace("\n>", "\n")diff --git a/crates/edit_prediction/src/udiff.rs b/crates/edit_prediction/src/udiff.rsindex 00664b2561a..e1e475c8552 100644--- a/crates/edit_prediction/src/udiff.rs+++ b/crates/edit_prediction/src/udiff.rs@@ -271,7 +271,7 @@ pub fn strip_diff_metadata(diff: &str) -> String {fn disambiguate_by_line_number(candidates: &[usize],expected_line: Option<u32>,- offset_to_line: impl Fn(usize) -> u32,+ offset_to_line: &dyn Fn(usize) -> u32,) -> Option<usize> {match candidates.len() {0 => None,@@ -316,7 +316,7 @@ pub fn apply_diff_to_string_with_hunk_offset(.collect();let hunk_offset =- disambiguate_by_line_number(&candidates, hunk.start_line, |offset| {+ disambiguate_by_line_number(&candidates, hunk.start_line, &|offset| {text[..offset].matches('\n').count() as u32}).ok_or_else(|| anyhow!("couldn't resolve hunk"))?;@@ -363,7 +363,7 @@ pub fn edits_for_diff(content: &str, diff_str: &str) -> Result<Vec<(Range<usize>.collect();let Some(context_offset) =- disambiguate_by_line_number(&candidates, hunk.start_line, |offset| {+ disambiguate_by_line_number(&candidates, hunk.start_line, &|offset| {content[..offset].matches('\n').count() as u32})else {@@ -628,7 +628,7 @@ fn resolve_hunk_edits_in_buffer(}}- disambiguate_by_line_number(&candidates, hunk.start_line, |offset| {+ disambiguate_by_line_number(&candidates, hunk.start_line, &|offset| {buffer.offset_to_point(offset).row}).ok_or_else(|| {diff --git a/crates/editor/src/bracket_colorization.rs b/crates/editor/src/bracket_colorization.rsindex 3710016b51f..05307b4f445 100644--- a/crates/editor/src/bracket_colorization.rs+++ b/crates/editor/src/bracket_colorization.rs@@ -1039,7 +1039,7 @@ mod foo «1{let actual_ranges = cx.update_editor(|editor, window, cx| {editor.snapshot(window, cx)- .all_text_highlight_ranges(|key| matches!(key, HighlightKey::ColorizeBracket(_)))+ .all_text_highlight_ranges(&|key| matches!(key, HighlightKey::ColorizeBracket(_)))});let mut highlighted_brackets = HashMap::default();@@ -1067,7 +1067,7 @@ mod foo «1{let ranges_after_scrolling = cx.update_editor(|editor, window, cx| {editor.snapshot(window, cx)- .all_text_highlight_ranges(|key| matches!(key, HighlightKey::ColorizeBracket(_)))+ .all_text_highlight_ranges(&|key| matches!(key, HighlightKey::ColorizeBracket(_)))});let new_last_bracket = ranges_after_scrolling.iter()@@ -1095,7 +1095,7 @@ mod foo «1{let colored_brackets = cx.update_editor(|editor, window, cx| {editor.snapshot(window, cx)- .all_text_highlight_ranges(|key| {+ .all_text_highlight_ranges(&|key| {matches!(key, HighlightKey::ColorizeBracket(_))})});@@ -1424,7 +1424,7 @@ mod foo «1{}let actual_ranges = snapshot- .all_text_highlight_ranges(|key| matches!(key, HighlightKey::ColorizeBracket(_)));+ .all_text_highlight_ranges(&|key| matches!(key, HighlightKey::ColorizeBracket(_)));let editor_text = snapshot.text();let mut next_index = 1;diff --git a/crates/editor/src/display_map.rs b/crates/editor/src/display_map.rsindex 19f1df70efd..119699da7fa 100644--- a/crates/editor/src/display_map.rs+++ b/crates/editor/src/display_map.rs@@ -2377,7 +2377,7 @@ impl DisplaySnapshot {#[instrument(skip_all)]pub fn all_text_highlight_ranges(&self,- f: impl Fn(&HighlightKey) -> bool,+ f: &dyn Fn(&HighlightKey) -> bool,) -> Vec<(gpui::Hsla, Range<Point>)> {use itertools::Itertools;@@ -2636,7 +2636,7 @@ pub mod tests {log::info!("wrap width: {:?}", wrap_width);cx.update(|cx| {- init_test(cx, |s| {+ init_test(cx, &|s| {s.project.all_languages.defaults.tab_size = NonZeroU32::new(tab_size)});});@@ -2891,7 +2891,7 @@ pub mod tests {cx.background_executor.set_block_on_ticks(usize::MAX..=usize::MAX);cx.update(|cx| {- init_test(cx, |_| {});+ init_test(cx, &|_| {});});let mut cx = crate::test::editor_test_context::EditorTestContext::new(cx).await;@@ -3011,7 +3011,7 @@ pub mod tests {#[gpui::test]fn test_text_chunks(cx: &mut gpui::App) {- init_test(cx, |_| {});+ init_test(cx, &|_| {});let text = sample_text(6, 6, 'a');let buffer = MultiBuffer::build_simple(&text, cx);@@ -3072,7 +3072,7 @@ pub mod tests {#[gpui::test]fn test_inlays_with_newlines_after_blocks(cx: &mut gpui::TestAppContext) {- cx.update(|cx| init_test(cx, |_| {}));+ cx.update(|cx| init_test(cx, &|_| {}));let buffer = cx.new(|cx| Buffer::local("a", cx));let buffer = cx.new(|cx| MultiBuffer::singleton(buffer, cx));@@ -3169,7 +3169,7 @@ pub mod tests {language.set_theme(&theme);cx.update(|cx| {- init_test(cx, |s| {+ init_test(cx, &|s| {s.project.all_languages.defaults.tab_size = Some(2.try_into().unwrap())})});@@ -3274,7 +3274,7 @@ pub mod tests {);language.set_theme(&theme);- cx.update(|cx| init_test(cx, |_| {}));+ cx.update(|cx| init_test(cx, &|_| {}));let buffer = cx.new(|cx| Buffer::local(text, cx).with_language(language, cx));cx.condition(&buffer, |buf, _| !buf.is_parsing()).await;@@ -3359,7 +3359,7 @@ pub mod tests {"#.unindent();- cx.update(|cx| init_test(cx, |_| {}));+ cx.update(|cx| init_test(cx, &|_| {}));let buffer = cx.new(|cx| Buffer::local(text, cx));@@ -3472,7 +3472,7 @@ pub mod tests {cx.background_executor.set_block_on_ticks(usize::MAX..=usize::MAX);- cx.update(|cx| init_test(cx, |_| {}));+ cx.update(|cx| init_test(cx, &|_| {}));let buffer = cx.update(|cx| MultiBuffer::build_simple("abcde\nfghij\nklmno\npqrst", cx));let buffer_snapshot = buffer.read_with(cx, |buffer, cx| buffer.snapshot(cx));@@ -3609,7 +3609,7 @@ pub mod tests {);language.set_theme(&theme);- cx.update(|cx| init_test(cx, |_| {}));+ cx.update(|cx| init_test(cx, &|_| {}));let buffer = cx.new(|cx| Buffer::local(text, cx).with_language(language, cx));cx.condition(&buffer, |buf, _| !buf.is_parsing()).await;@@ -3670,7 +3670,7 @@ pub mod tests {#[gpui::test]async fn test_chunks_with_text_highlights(cx: &mut gpui::TestAppContext) {- cx.update(|cx| init_test(cx, |_| {}));+ cx.update(|cx| init_test(cx, &|_| {}));let theme =SyntaxTheme::new_test(vec![("operator", Hsla::red()), ("string", Hsla::green())]);@@ -3757,7 +3757,7 @@ pub mod tests {#[gpui::test]fn test_clip_point(cx: &mut gpui::App) {- init_test(cx, |_| {});+ init_test(cx, &|_| {});fn assert(text: &str, shift_right: bool, bias: Bias, cx: &mut gpui::App) {let (unmarked_snapshot, mut markers) = marked_display_snapshot(text, cx);@@ -3807,7 +3807,7 @@ pub mod tests {#[gpui::test]fn test_clip_at_line_ends(cx: &mut gpui::App) {- init_test(cx, |_| {});+ init_test(cx, &|_| {});fn assert(text: &str, cx: &mut gpui::App) {let (mut unmarked_snapshot, markers) = marked_display_snapshot(text, cx);@@ -3826,7 +3826,7 @@ pub mod tests {#[gpui::test]fn test_creases(cx: &mut gpui::App) {- init_test(cx, |_| {});+ init_test(cx, &|_| {});let text = "aaa\nbbb\nccc\nddd\neee\nfff\nggg\nhhh\niii\njjj\nkkk\nlll";let buffer = MultiBuffer::build_simple(text, cx);@@ -3863,7 +3863,7 @@ pub mod tests {#[gpui::test]fn test_tabs_with_multibyte_chars(cx: &mut gpui::App) {- init_test(cx, |_| {});+ init_test(cx, &|_| {});let text = "✅\t\tα\nβ\t\n🏀β\t\tγ";let buffer = MultiBuffer::build_simple(text, cx);@@ -3941,7 +3941,7 @@ pub mod tests {#[gpui::test]fn test_max_point(cx: &mut gpui::App) {- init_test(cx, |_| {});+ init_test(cx, &|_| {});let buffer = MultiBuffer::build_simple("aaa\n\t\tbbb", cx);let font_size = px(14.0);@@ -4001,7 +4001,7 @@ pub mod tests {chunks}- fn init_test(cx: &mut App, f: impl Fn(&mut SettingsContent)) {+ fn init_test(cx: &mut App, f: &dyn Fn(&mut SettingsContent)) {let settings = SettingsStore::test(cx);cx.set_global(settings);crate::init(cx);@@ -4013,7 +4013,7 @@ pub mod tests {#[gpui::test]fn test_isomorphic_display_point_ranges_for_buffer_range(cx: &mut gpui::TestAppContext) {- cx.update(|cx| init_test(cx, |_| {}));+ cx.update(|cx| init_test(cx, &|_| {}));let buffer = cx.new(|cx| Buffer::local("let x = 5;\n", cx));let buffer = cx.new(|cx| MultiBuffer::singleton(buffer, cx));diff --git a/crates/editor/src/document_symbols.rs b/crates/editor/src/document_symbols.rsindex efd2e59153c..927ef346904 100644--- a/crates/editor/src/document_symbols.rs+++ b/crates/editor/src/document_symbols.rs@@ -453,7 +453,7 @@ mod tests {async fn test_lsp_document_symbols_fetches_when_enabled(cx: &mut TestAppContext) {init_test(cx, |_| {});- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {settings.defaults.document_symbols = Some(DocumentSymbols::On);});@@ -493,7 +493,7 @@ mod tests {async fn test_lsp_document_symbols_nested(cx: &mut TestAppContext) {init_test(cx, |_| {});- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {settings.defaults.document_symbols = Some(DocumentSymbols::On);});@@ -589,7 +589,7 @@ mod tests {});// Step 2: Switch to LSP- update_test_language_settings(&mut cx.cx.cx, |settings| {+ update_test_language_settings(&mut cx.cx.cx, &|settings| {settings.defaults.document_symbols = Some(DocumentSymbols::On);});assert!(symbol_request.next().await.is_some());@@ -604,7 +604,7 @@ mod tests {});// Step 3: Switch back to tree-sitter- update_test_language_settings(&mut cx.cx.cx, |settings| {+ update_test_language_settings(&mut cx.cx.cx, &|settings| {settings.defaults.document_symbols = Some(DocumentSymbols::Off);});cx.run_until_parked();@@ -628,7 +628,7 @@ mod tests {async fn test_lsp_document_symbols_caches_results(cx: &mut TestAppContext) {init_test(cx, |_| {});- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {settings.defaults.document_symbols = Some(DocumentSymbols::On);});@@ -686,7 +686,7 @@ mod tests {async fn test_lsp_document_symbols_flat_response(cx: &mut TestAppContext) {init_test(cx, |_| {});- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {settings.defaults.document_symbols = Some(DocumentSymbols::On);});@@ -731,7 +731,7 @@ mod tests {async fn test_breadcrumbs_use_lsp_symbols(cx: &mut TestAppContext) {init_test(cx, |_| {});- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {settings.defaults.document_symbols = Some(DocumentSymbols::On);});@@ -780,7 +780,7 @@ mod tests {async fn test_lsp_document_symbols_multibyte_highlights(cx: &mut TestAppContext) {init_test(cx, |_| {});- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {settings.defaults.document_symbols = Some(DocumentSymbols::On);});@@ -860,7 +860,7 @@ mod tests {async fn test_lsp_document_symbols_empty_response(cx: &mut TestAppContext) {init_test(cx, |_| {});- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {settings.defaults.document_symbols = Some(DocumentSymbols::On);});diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rsindex 3fa52ed21e6..62fa1506b45 100644--- a/crates/editor/src/editor.rs+++ b/crates/editor/src/editor.rs@@ -9459,7 +9459,7 @@ impl Editor {if target_display_point.row() < visible_row_range.start {return self.render_edit_prediction_scroll_popover(- |_| SCROLL_PADDING_Y,+ &|_| SCROLL_PADDING_Y,IconName::ArrowUp,visible_row_range,line_layouts,@@ -9470,7 +9470,7 @@ impl Editor {);} else if target_display_point.row() >= visible_row_range.end {return self.render_edit_prediction_scroll_popover(- |size| text_bounds.size.height - size.height - SCROLL_PADDING_Y,+ &|size| text_bounds.size.height - size.height - SCROLL_PADDING_Y,IconName::ArrowDown,visible_row_range,line_layouts,@@ -9536,7 +9536,7 @@ impl Editor {fn render_edit_prediction_scroll_popover(&mut self,- to_y: impl Fn(Size<Pixels>) -> Pixels,+ to_y: &dyn Fn(Size<Pixels>) -> Pixels,scroll_icon: IconName,visible_row_range: Range<DisplayRow>,line_layouts: &[LineWithInvisibles],@@ -26849,7 +26849,7 @@ fn snippet_completions(.enumerate().map(move |(prefix_ix, prefix)| {let word_count =- snippet_candidate_suffixes(prefix, is_word_char).count();+ snippet_candidate_suffixes(prefix, &is_word_char).count();((snippet_ix, prefix_ix), prefix, word_count)})})@@ -26859,7 +26859,7 @@ fn snippet_completions(// Each prefix may be matched multiple times; the completion menu must filter out duplicates.- let buffer_windows = snippet_candidate_suffixes(&max_buffer_window, is_word_char)+ let buffer_windows = snippet_candidate_suffixes(&max_buffer_window, &is_word_char).take(sorted_snippet_candidates.first()@@ -28470,10 +28470,10 @@ pub(crate) fn split_words(text: &str) -> impl std::iter::Iterator<Item = &str> +/// every non-word character).////// Shorter suffixes are returned first.-pub(crate) fn snippet_candidate_suffixes(- text: &str,- is_word_char: impl Fn(char) -> bool,-) -> impl std::iter::Iterator<Item = &str> {+pub(crate) fn snippet_candidate_suffixes<'a>(+ text: &'a str,+ is_word_char: &'a dyn Fn(char) -> bool,+) -> impl std::iter::Iterator<Item = &'a str> + 'a {let mut prev_index = text.len();let mut prev_codepoint = None;text.char_indices()diff --git a/crates/editor/src/editor_tests.rs b/crates/editor/src/editor_tests.rsindex bc44038c05c..695491b6ea7 100644--- a/crates/editor/src/editor_tests.rs+++ b/crates/editor/src/editor_tests.rs@@ -50,7 +50,7 @@ use serde_json::{self, json};use settings::{AllLanguageSettingsContent, DelayMs, EditorSettingsContent, GlobalLspSettingsContent,IndentGuideBackgroundColoring, IndentGuideColoring, InlayHintSettingsContent,- ProjectSettingsContent, SearchSettingsContent, SettingsStore,+ ProjectSettingsContent, SearchSettingsContent, SettingsContent, SettingsStore,};use std::{cell::RefCell, future::Future, rc::Rc, sync::atomic::AtomicBool, time::Instant};use std::{@@ -3702,7 +3702,7 @@ async fn test_newline_comments(cx: &mut TestAppContext) {"});}// Ensure that comment continuations can be disabled.- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {settings.defaults.extend_comment_on_newline = Some(false);});let mut cx = EditorTestContext::new(cx).await;@@ -3997,7 +3997,7 @@ async fn test_newline_documentation_comments(cx: &mut TestAppContext) {"});}// Ensure that comment continuations can be disabled.- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {settings.defaults.extend_comment_on_newline = Some(false);});let mut cx = EditorTestContext::new(cx).await;@@ -9152,7 +9152,7 @@ async fn test_select_next(cx: &mut TestAppContext) {let mut cx = EditorTestContext::new(cx).await;// Enable case sensitive search.- update_test_editor_settings(&mut cx, |settings| {+ update_test_editor_settings(&mut cx, &|settings| {let mut search_settings = SearchSettingsContent::default();search_settings.case_sensitive = Some(true);settings.search = Some(search_settings);@@ -9197,7 +9197,7 @@ async fn test_select_next(cx: &mut TestAppContext) {cx.assert_editor_state("«ˇfoo»\nFOO\nFoo\n«ˇfoo»");// Disable case sensitive search.- update_test_editor_settings(&mut cx, |settings| {+ update_test_editor_settings(&mut cx, &|settings| {let mut search_settings = SearchSettingsContent::default();search_settings.case_sensitive = Some(false);settings.search = Some(search_settings);@@ -9217,7 +9217,7 @@ async fn test_select_all_matches(cx: &mut TestAppContext) {let mut cx = EditorTestContext::new(cx).await;// Enable case sensitive search.- update_test_editor_settings(&mut cx, |settings| {+ update_test_editor_settings(&mut cx, &|settings| {let mut search_settings = SearchSettingsContent::default();search_settings.case_sensitive = Some(true);settings.search = Some(search_settings);@@ -9276,7 +9276,7 @@ async fn test_select_all_matches(cx: &mut TestAppContext) {cx.assert_editor_state("«fooˇ»\nFOO\nFoo");// Disable case sensitive search.- update_test_editor_settings(&mut cx, |settings| {+ update_test_editor_settings(&mut cx, &|settings| {let mut search_settings = SearchSettingsContent::default();search_settings.case_sensitive = Some(false);settings.search = Some(search_settings);@@ -9662,7 +9662,7 @@ async fn test_select_previous_with_single_selection(cx: &mut TestAppContext) {let mut cx = EditorTestContext::new(cx).await;// Enable case sensitive search.- update_test_editor_settings(&mut cx, |settings| {+ update_test_editor_settings(&mut cx, &|settings| {let mut search_settings = SearchSettingsContent::default();search_settings.case_sensitive = Some(true);settings.search = Some(search_settings);@@ -9704,7 +9704,7 @@ async fn test_select_previous_with_single_selection(cx: &mut TestAppContext) {cx.assert_editor_state("«ˇfoo»\nFOO\nFoo\n«ˇfoo»");// Disable case sensitive search.- update_test_editor_settings(&mut cx, |settings| {+ update_test_editor_settings(&mut cx, &|settings| {let mut search_settings = SearchSettingsContent::default();search_settings.case_sensitive = Some(false);settings.search = Some(search_settings);@@ -12548,7 +12548,7 @@ async fn test_document_format_during_save(cx: &mut TestAppContext) {}// Set rust language override and assert overridden tabsize is sent to language server- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {settings.languages.0.insert("Rust".into(),LanguageSettingsContent {@@ -13203,7 +13203,7 @@ async fn test_range_format_respects_language_tab_size_override(cx: &mut TestAppClet (project, editor, cx, fake_server) = setup_range_format_test(cx).await;// Set Rust language override and assert overridden tabsize is sent to language server- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {settings.languages.0.insert("Rust".into(),LanguageSettingsContent {@@ -13269,7 +13269,7 @@ async fn test_document_format_manual_trigger(cx: &mut TestAppContext) {},Some(tree_sitter_rust::LANGUAGE.into()),)));- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {// Enable Prettier formatting for the same buffer, and ensure// LSP is called instead of Prettier.settings.defaults.prettier.get_or_insert_default().allowed = Some(true);@@ -13651,7 +13651,7 @@ async fn test_organize_imports_manual_trigger(cx: &mut TestAppContext) {},Some(tree_sitter_typescript::LANGUAGE_TYPESCRIPT.into()),)));- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {settings.defaults.prettier.get_or_insert_default().allowed = Some(true);});let mut fake_servers = language_registry.register_fake_lsp(@@ -15081,7 +15081,7 @@ async fn test_completion_mode(cx: &mut TestAppContext) {run.run_description,);- update_test_language_settings(&mut cx, |settings| {+ update_test_language_settings(&mut cx, &|settings| {settings.defaults.completions = Some(CompletionSettingsContent {lsp_insert_mode: Some(lsp_insert_mode),words: Some(WordsCompletionMode::Disabled),@@ -15151,7 +15151,7 @@ async fn test_completion_with_mode_specified_by_action(cx: &mut TestAppContext)let expected_with_insert_mode = "SubscriptionErrorˇError";let expected_with_replace_mode = "SubscriptionErrorˇ";- update_test_language_settings(&mut cx, |settings| {+ update_test_language_settings(&mut cx, &|settings| {settings.defaults.completions = Some(CompletionSettingsContent {words: Some(WordsCompletionMode::Disabled),words_min_length: Some(0),@@ -15187,7 +15187,7 @@ async fn test_completion_with_mode_specified_by_action(cx: &mut TestAppContext)handle_resolve_completion_request(&mut cx, None).await;apply_additional_edits.await.unwrap();- update_test_language_settings(&mut cx, |settings| {+ update_test_language_settings(&mut cx, &|settings| {settings.defaults.completions = Some(CompletionSettingsContent {words: Some(WordsCompletionMode::Disabled),words_min_length: Some(0),@@ -15769,7 +15769,7 @@ async fn test_completion(cx: &mut TestAppContext) {apply_additional_edits.await.unwrap();- update_test_language_settings(&mut cx, |settings| {+ update_test_language_settings(&mut cx, &|settings| {settings.defaults.show_completions_on_input = Some(false);});cx.set_state("editorˇ");@@ -18756,7 +18756,7 @@ fn test_split_words() {#[test]fn test_split_words_for_snippet_prefix() {fn split(text: &str) -> Vec<&str> {- snippet_candidate_suffixes(text, |c| c.is_alphanumeric() || c == '_').collect()+ snippet_candidate_suffixes(text, &|c| c.is_alphanumeric() || c == '_').collect()}assert_eq!(split("HelloWorld"), &["HelloWorld"]);@@ -19157,7 +19157,7 @@ async fn test_language_server_restart_due_to_settings_change(cx: &mut TestAppCon.await.unwrap();let _fake_server = fake_servers.next().await.unwrap();- update_test_language_settings(cx, |language_settings| {+ update_test_language_settings(cx, &|language_settings| {language_settings.languages.0.insert(language_name.clone().0.to_string(),LanguageSettingsContent {@@ -19173,7 +19173,7 @@ async fn test_language_server_restart_due_to_settings_change(cx: &mut TestAppCon"Should not restart LSP server on an unrelated change");- update_test_project_settings(cx, |project_settings| {+ update_test_project_settings(cx, &|project_settings| {project_settings.lsp.0.insert("Some other server name".into(),LspSettings {@@ -19194,7 +19194,7 @@ async fn test_language_server_restart_due_to_settings_change(cx: &mut TestAppCon"Should not restart LSP server on an unrelated LSP settings change");- update_test_project_settings(cx, |project_settings| {+ update_test_project_settings(cx, &|project_settings| {project_settings.lsp.0.insert(language_server_name.into(),LspSettings {@@ -19215,7 +19215,7 @@ async fn test_language_server_restart_due_to_settings_change(cx: &mut TestAppCon"Should restart LSP server on a related LSP settings change");- update_test_project_settings(cx, |project_settings| {+ update_test_project_settings(cx, &|project_settings| {project_settings.lsp.0.insert(language_server_name.into(),LspSettings {@@ -19236,7 +19236,7 @@ async fn test_language_server_restart_due_to_settings_change(cx: &mut TestAppCon"Should not restart LSP server on a related LSP settings change that is the same");- update_test_project_settings(cx, |project_settings| {+ update_test_project_settings(cx, &|project_settings| {project_settings.lsp.0.insert(language_server_name.into(),LspSettings {@@ -20081,7 +20081,7 @@ async fn test_document_format_with_prettier(cx: &mut TestAppContext) {},Some(tree_sitter_typescript::LANGUAGE_TYPESCRIPT.into()),)));- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {settings.defaults.prettier.get_or_insert_default().allowed = Some(true);});@@ -20127,7 +20127,7 @@ async fn test_document_format_with_prettier(cx: &mut TestAppContext) {"Test prettier formatting was not applied to the original buffer text",);- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {settings.defaults.formatter = Some(FormatterList::default())});let format = editor.update_in(cx, |editor, window, cx| {@@ -20175,7 +20175,7 @@ async fn test_document_format_with_prettier_explicit_language(cx: &mut TestAppColanguage_registry.add(ts_lang.clone());- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {settings.defaults.prettier.get_or_insert_default().allowed = Some(true);});@@ -20225,7 +20225,7 @@ async fn test_document_format_with_prettier_explicit_language(cx: &mut TestAppCo"Test prettier formatting was not applied to the original buffer text",);- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {settings.defaults.formatter = Some(FormatterList::default())});let format = editor.update_in(cx, |editor, window, cx| {@@ -24596,7 +24596,7 @@ async fn test_edit_prediction_text(cx: &mut TestAppContext) {vec![(Point::new(0, 6)..Point::new(0, 6), " beautiful".into())],true,cx,- |highlighted_edits, cx| {+ &|highlighted_edits, cx| {assert_eq!(highlighted_edits.text, "Hello, beautiful world!");assert_eq!(highlighted_edits.highlights.len(), 1);assert_eq!(highlighted_edits.highlights[0].0, 6..16);@@ -24614,7 +24614,7 @@ async fn test_edit_prediction_text(cx: &mut TestAppContext) {vec![(Point::new(0, 0)..Point::new(0, 4), "That".into())],false,cx,- |highlighted_edits, cx| {+ &|highlighted_edits, cx| {assert_eq!(highlighted_edits.text, "That is a test.");assert_eq!(highlighted_edits.highlights.len(), 1);assert_eq!(highlighted_edits.highlights[0].0, 0..4);@@ -24635,7 +24635,7 @@ async fn test_edit_prediction_text(cx: &mut TestAppContext) {],false,cx,- |highlighted_edits, cx| {+ &|highlighted_edits, cx| {assert_eq!(highlighted_edits.text, "Greetings, world and universe!");assert_eq!(highlighted_edits.highlights.len(), 2);assert_eq!(highlighted_edits.highlights[0].0, 0..9);@@ -24665,7 +24665,7 @@ async fn test_edit_prediction_text(cx: &mut TestAppContext) {],false,cx,- |highlighted_edits, cx| {+ &|highlighted_edits, cx| {assert_eq!(highlighted_edits.text,"Second modified\nNew third line\nFourth updated line"@@ -24695,7 +24695,7 @@ async fn test_edit_prediction_text_with_deletions(cx: &mut TestAppContext) {vec![(Point::new(0, 5)..Point::new(0, 11), "".to_string())],true,cx,- |highlighted_edits, cx| {+ &|highlighted_edits, cx| {assert_eq!(highlighted_edits.text, "Hello, world!");assert_eq!(highlighted_edits.highlights.len(), 1);assert_eq!(highlighted_edits.highlights[0].0, 5..11);@@ -24713,7 +24713,7 @@ async fn test_edit_prediction_text_with_deletions(cx: &mut TestAppContext) {vec![(Point::new(0, 6)..Point::new(0, 6), " digital".to_string())],true,cx,- |highlighted_edits, cx| {+ &|highlighted_edits, cx| {assert_eq!(highlighted_edits.highlights.len(), 1);assert_eq!(highlighted_edits.highlights[0].0, 6..14);assert_eq!(@@ -24730,7 +24730,7 @@ async fn assert_highlighted_edits(edits: Vec<(Range<Point>, String)>,include_deletions: bool,cx: &mut TestAppContext,- assertion_fn: impl Fn(HighlightedText, &App),+ assertion_fn: &dyn Fn(HighlightedText, &App),) {let window = cx.add_window(|window, cx| {let buffer = MultiBuffer::build_simple(text, cx);@@ -27000,7 +27000,7 @@ async fn test_outdent_after_input_for_python(cx: &mut TestAppContext) {#[gpui::test]async fn test_indent_on_newline_for_python(cx: &mut TestAppContext) {init_test(cx, |_| {});- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {settings.defaults.extend_comment_on_newline = Some(false);});let mut cx = EditorTestContext::new(cx).await;@@ -27405,7 +27405,7 @@ async fn test_outdent_after_input_for_bash(cx: &mut TestAppContext) {#[gpui::test]async fn test_indent_on_newline_for_bash(cx: &mut TestAppContext) {init_test(cx, |_| {});- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {settings.defaults.extend_comment_on_newline = Some(false);});let mut cx = EditorTestContext::new(cx).await;@@ -27959,18 +27959,20 @@ fn handle_resolve_completion_request(pub(crate) fn update_test_language_settings(cx: &mut TestAppContext,- f: impl Fn(&mut AllLanguageSettingsContent),+ f: &dyn Fn(&mut AllLanguageSettingsContent),) {cx.update(|cx| {SettingsStore::update_global(cx, |store, cx| {- store.update_user_settings(cx, |settings| f(&mut settings.project.all_languages));+ store.update_user_settings(cx, &|settings: &mut SettingsContent| {+ f(&mut settings.project.all_languages)+ });});});}pub(crate) fn update_test_project_settings(cx: &mut TestAppContext,- f: impl Fn(&mut ProjectSettingsContent),+ f: &dyn Fn(&mut ProjectSettingsContent),) {cx.update(|cx| {SettingsStore::update_global(cx, |store, cx| {@@ -27981,7 +27983,7 @@ pub(crate) fn update_test_project_settings(pub(crate) fn update_test_editor_settings(cx: &mut TestAppContext,- f: impl Fn(&mut EditorSettingsContent),+ f: &dyn Fn(&mut EditorSettingsContent),) {cx.update(|cx| {SettingsStore::update_global(cx, |store, cx| {@@ -28000,7 +28002,7 @@ pub(crate) fn init_test(cx: &mut TestAppContext, f: fn(&mut AllLanguageSettingsCcrate::init(cx);});zlog::init_test();- update_test_language_settings(cx, f);+ update_test_language_settings(cx, &f);}#[track_caller]@@ -28435,7 +28437,7 @@ async fn test_inlay_hints_request_timeout(cx: &mut TestAppContext) {let request_count = Arc::new(AtomicU32::new(0));let closure_request_count = request_count.clone();- init_test(cx, |settings| {+ init_test(cx, &|settings| {settings.defaults.inlay_hints = Some(InlayHintSettingsContent {enabled: Some(true),..InlayHintSettingsContent::default()@@ -28443,7 +28445,7 @@ async fn test_inlay_hints_request_timeout(cx: &mut TestAppContext) {});cx.update(|cx| {SettingsStore::update_global(cx, |store, cx| {- store.update_user_settings(cx, |settings| {+ store.update_user_settings(cx, &|settings: &mut SettingsContent| {settings.global_lsp_settings = Some(GlobalLspSettingsContent {request_timeout: Some(BASE_TIMEOUT_SECS),button: Some(true),diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rsindex 71dffc0eda5..0cdd1c80454 100644--- a/crates/editor/src/element.rs+++ b/crates/editor/src/element.rs@@ -12529,7 +12529,7 @@ mod tests {Editor::new(EditorMode::full(), buffer, None, window, cx)});- update_test_language_settings(cx, |s| {+ update_test_language_settings(cx, &|s| {s.defaults.preferred_line_length = Some(5_u32);s.defaults.soft_wrap = Some(language_settings::SoftWrap::PreferredLineLength);});@@ -12909,7 +12909,7 @@ mod tests {let mut editor_width = 200.0;while editor_width <= 1000.0 {for show_line_numbers in [true, false] {- update_test_language_settings(cx, |s| {+ update_test_language_settings(cx, &|s| {s.defaults.tab_size = NonZeroU32::new(tab_size);s.defaults.show_whitespaces = Some(ShowWhitespaceSetting::All);s.defaults.preferred_line_length = Some(editor_width as u32);diff --git a/crates/editor/src/folding_ranges.rs b/crates/editor/src/folding_ranges.rsindex 175f2cfa396..593095b0047 100644--- a/crates/editor/src/folding_ranges.rs+++ b/crates/editor/src/folding_ranges.rs@@ -142,7 +142,7 @@ mod tests {async fn test_lsp_folding_ranges_populates_creases(cx: &mut TestAppContext) {init_test(cx, |_| {});- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {settings.defaults.document_folding_ranges = Some(DocumentFoldingRanges::On);});@@ -270,7 +270,7 @@ mod tests {async fn test_lsp_folding_ranges_toggling_off_removes_creases(cx: &mut TestAppContext) {init_test(cx, |_| {});- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {settings.defaults.document_folding_ranges = Some(DocumentFoldingRanges::On);});@@ -320,7 +320,7 @@ mod tests {assert_eq!(editor.display_text(cx), "fn main() ⋯\n",);});- update_test_language_settings(&mut cx.cx.cx, |settings| {+ update_test_language_settings(&mut cx.cx.cx, &|settings| {settings.defaults.document_folding_ranges = Some(DocumentFoldingRanges::Off);});cx.run_until_parked();@@ -337,7 +337,7 @@ mod tests {async fn test_lsp_folding_ranges_nested_folds(cx: &mut TestAppContext) {init_test(cx, |_| {});- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {settings.defaults.document_folding_ranges = Some(DocumentFoldingRanges::On);});@@ -427,7 +427,7 @@ mod tests {async fn test_lsp_folding_ranges_unsorted_from_server(cx: &mut TestAppContext) {init_test(cx, |_| {});- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {settings.defaults.document_folding_ranges = Some(DocumentFoldingRanges::On);});@@ -580,7 +580,7 @@ mod tests {},);- update_test_language_settings(&mut cx.cx.cx, |settings| {+ update_test_language_settings(&mut cx.cx.cx, &|settings| {settings.defaults.document_folding_ranges = Some(DocumentFoldingRanges::On);});assert!(folding_request.next().await.is_some());@@ -645,7 +645,7 @@ mod tests {});// Phase 3: switch back to tree-sitter by disabling LSP folding ranges.- update_test_language_settings(&mut cx.cx.cx, |settings| {+ update_test_language_settings(&mut cx.cx.cx, &|settings| {settings.defaults.document_folding_ranges = Some(DocumentFoldingRanges::Off);});cx.run_until_parked();@@ -674,7 +674,7 @@ mod tests {async fn test_lsp_folding_ranges_collapsed_text(cx: &mut TestAppContext) {init_test(cx, |_| {});- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {settings.defaults.document_folding_ranges = Some(DocumentFoldingRanges::On);});@@ -1085,7 +1085,7 @@ mod tests {async fn test_lsp_folding_ranges_with_multibyte_characters(cx: &mut TestAppContext) {init_test(cx, |_| {});- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {settings.defaults.document_folding_ranges = Some(DocumentFoldingRanges::On);});diff --git a/crates/editor/src/inlays/inlay_hints.rs b/crates/editor/src/inlays/inlay_hints.rsindex bcbf7d99b8d..72951834ff4 100644--- a/crates/editor/src/inlays/inlay_hints.rs+++ b/crates/editor/src/inlays/inlay_hints.rs@@ -989,7 +989,7 @@ pub mod tests {#[gpui::test]async fn test_basic_cache_update_with_duplicate_hints(cx: &mut gpui::TestAppContext) {let allowed_hint_kinds = HashSet::from_iter([None, Some(InlayHintKind::Type)]);- init_test(cx, |settings| {+ init_test(cx, &|settings| {settings.defaults.inlay_hints = Some(InlayHintSettingsContent {show_value_hints: Some(true),enabled: Some(true),@@ -1101,7 +1101,7 @@ pub mod tests {#[gpui::test]async fn test_racy_cache_updates(cx: &mut gpui::TestAppContext) {- init_test(cx, |settings| {+ init_test(cx, &|settings| {settings.defaults.inlay_hints = Some(InlayHintSettingsContent {enabled: Some(true),..InlayHintSettingsContent::default()@@ -1185,7 +1185,7 @@ pub mod tests {#[gpui::test]async fn test_cache_update_on_lsp_completion_tasks(cx: &mut gpui::TestAppContext) {- init_test(cx, |settings| {+ init_test(cx, &|settings| {settings.defaults.inlay_hints = Some(InlayHintSettingsContent {show_value_hints: Some(true),enabled: Some(true),@@ -1295,7 +1295,7 @@ pub mod tests {#[gpui::test]async fn test_no_hint_updates_for_unrelated_language_files(cx: &mut gpui::TestAppContext) {- init_test(cx, |settings| {+ init_test(cx, &|settings| {settings.defaults.inlay_hints = Some(InlayHintSettingsContent {show_value_hints: Some(true),enabled: Some(true),@@ -1542,7 +1542,7 @@ pub mod tests {#[gpui::test]async fn test_hint_setting_changes(cx: &mut gpui::TestAppContext) {let allowed_hint_kinds = HashSet::from_iter([None, Some(InlayHintKind::Type)]);- init_test(cx, |settings| {+ init_test(cx, &|settings| {settings.defaults.inlay_hints = Some(InlayHintSettingsContent {show_value_hints: Some(true),enabled: Some(true),@@ -1705,7 +1705,7 @@ pub mod tests {],),] {- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {settings.defaults.inlay_hints = Some(InlayHintSettingsContent {show_value_hints: Some(true),enabled: Some(true),@@ -1752,7 +1752,7 @@ pub mod tests {}let another_allowed_hint_kinds = HashSet::from_iter([Some(InlayHintKind::Type)]);- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {settings.defaults.inlay_hints = Some(InlayHintSettingsContent {show_value_hints: Some(true),enabled: Some(false),@@ -1825,7 +1825,7 @@ pub mod tests {.unwrap();let final_allowed_hint_kinds = HashSet::from_iter([Some(InlayHintKind::Parameter)]);- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {settings.defaults.inlay_hints = Some(InlayHintSettingsContent {show_value_hints: Some(true),enabled: Some(true),@@ -1903,7 +1903,7 @@ pub mod tests {#[gpui::test]async fn test_hint_request_cancellation(cx: &mut gpui::TestAppContext) {- init_test(cx, |settings| {+ init_test(cx, &|settings| {settings.defaults.inlay_hints = Some(InlayHintSettingsContent {show_value_hints: Some(true),enabled: Some(true),@@ -2040,7 +2040,7 @@ pub mod tests {#[gpui::test(iterations = 4)]async fn test_large_buffer_inlay_requests_split(cx: &mut gpui::TestAppContext) {- init_test(cx, |settings| {+ init_test(cx, &|settings| {settings.defaults.inlay_hints = Some(InlayHintSettingsContent {enabled: Some(true),..InlayHintSettingsContent::default()@@ -2267,7 +2267,7 @@ pub mod tests {#[gpui::test]async fn test_multiple_excerpts_large_multibuffer(cx: &mut gpui::TestAppContext) {- init_test(cx, |settings| {+ init_test(cx, &|settings| {settings.defaults.inlay_hints = Some(InlayHintSettingsContent {show_value_hints: Some(true),enabled: Some(true),@@ -2639,7 +2639,7 @@ pub mod tests {#[gpui::test]async fn test_editing_in_multi_buffer(cx: &mut gpui::TestAppContext) {- init_test(cx, |settings| {+ init_test(cx, &|settings| {settings.defaults.inlay_hints = Some(InlayHintSettingsContent {enabled: Some(true),..InlayHintSettingsContent::default()@@ -2877,7 +2877,7 @@ let c = 3;"##[gpui::test]async fn test_excerpts_removed(cx: &mut gpui::TestAppContext) {- init_test(cx, |settings| {+ init_test(cx, &|settings| {settings.defaults.inlay_hints = Some(InlayHintSettingsContent {show_value_hints: Some(true),enabled: Some(true),@@ -3070,7 +3070,7 @@ let c = 3;"#}).unwrap();- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {settings.defaults.inlay_hints = Some(InlayHintSettingsContent {show_value_hints: Some(true),enabled: Some(true),@@ -3109,7 +3109,7 @@ let c = 3;"##[gpui::test]async fn test_inside_char_boundary_range_hints(cx: &mut gpui::TestAppContext) {- init_test(cx, |settings| {+ init_test(cx, &|settings| {settings.defaults.inlay_hints = Some(InlayHintSettingsContent {show_value_hints: Some(true),enabled: Some(true),@@ -3220,7 +3220,7 @@ let c = 3;"##[gpui::test]async fn test_toggle_inlay_hints(cx: &mut gpui::TestAppContext) {- init_test(cx, |settings| {+ init_test(cx, &|settings| {settings.defaults.inlay_hints = Some(InlayHintSettingsContent {show_value_hints: Some(true),enabled: Some(false),@@ -3302,7 +3302,7 @@ let c = 3;"#}).unwrap();- update_test_language_settings(cx, |settings| {+ update_test_language_settings(cx, &|settings| {settings.defaults.inlay_hints = Some(InlayHintSettingsContent {show_value_hints: Some(true),enabled: Some(true),@@ -3368,7 +3368,7 @@ let c = 3;"##[gpui::test]async fn test_modifiers_change(cx: &mut gpui::TestAppContext) {- init_test(cx, |settings| {+ init_test(cx, &|settings| {settings.defaults.inlay_hints = Some(InlayHintSettingsContent {show_value_hints: Some(true),enabled: Some(true),@@ -3594,7 +3594,7 @@ let c = 3;"##[gpui::test]async fn test_inlays_at_the_same_place(cx: &mut gpui::TestAppContext) {- init_test(cx, |settings| {+ init_test(cx, &|settings| {settings.defaults.inlay_hints = Some(InlayHintSettingsContent {show_value_hints: Some(true),enabled: Some(true),@@ -3762,7 +3762,7 @@ let c = 3;"##[gpui::test]async fn test_invalidation_and_addition_race(cx: &mut gpui::TestAppContext) {- init_test(cx, |settings| {+ init_test(cx, &|settings| {settings.defaults.inlay_hints = Some(InlayHintSettingsContent {enabled: Some(true),..InlayHintSettingsContent::default()@@ -4137,7 +4137,7 @@ let c = 3;"#);}- pub(crate) fn init_test(cx: &mut TestAppContext, f: impl Fn(&mut AllLanguageSettingsContent)) {+ pub(crate) fn init_test(cx: &mut TestAppContext, f: &dyn Fn(&mut AllLanguageSettingsContent)) {cx.update(|cx| {let settings_store = SettingsStore::test(cx);cx.set_global(settings_store);diff --git a/crates/editor/src/semantic_tokens.rs b/crates/editor/src/semantic_tokens.rsindex ffbd87a44b3..d2bbe533124 100644--- a/crates/editor/src/semantic_tokens.rs+++ b/crates/editor/src/semantic_tokens.rs@@ -484,7 +484,7 @@ mod tests {async fn lsp_semantic_tokens_full_capability(cx: &mut TestAppContext) {init_test(cx, |_| {});- update_test_language_settings(cx, |language_settings| {+ update_test_language_settings(cx, &|language_settings| {language_settings.languages.0.insert("Rust".into(),LanguageSettingsContent {@@ -562,7 +562,7 @@ mod tests {async fn lsp_semantic_tokens_full_none_result_id(cx: &mut TestAppContext) {init_test(cx, |_| {});- update_test_language_settings(cx, |language_settings| {+ update_test_language_settings(cx, &|language_settings| {language_settings.languages.0.insert("Rust".into(),LanguageSettingsContent {@@ -638,7 +638,7 @@ mod tests {async fn lsp_semantic_tokens_delta(cx: &mut TestAppContext) {init_test(cx, |_| {});- update_test_language_settings(cx, |language_settings| {+ update_test_language_settings(cx, &|language_settings| {language_settings.languages.0.insert("Rust".into(),LanguageSettingsContent {@@ -734,7 +734,7 @@ mod tests {async fn lsp_semantic_tokens_multiserver_full(cx: &mut TestAppContext) {init_test(cx, |_| {});- update_test_language_settings(cx, |language_settings| {+ update_test_language_settings(cx, &|language_settings| {language_settings.languages.0.insert("TOML".into(),LanguageSettingsContent {@@ -954,7 +954,7 @@ mod tests {async fn lsp_semantic_tokens_multibuffer_part(cx: &mut TestAppContext) {init_test(cx, |_| {});- update_test_language_settings(cx, |language_settings| {+ update_test_language_settings(cx, &|language_settings| {language_settings.languages.0.insert("TOML".into(),LanguageSettingsContent {@@ -1238,7 +1238,7 @@ mod tests {async fn lsp_semantic_tokens_multibuffer_shared(cx: &mut TestAppContext) {init_test(cx, |_| {});- update_test_language_settings(cx, |language_settings| {+ update_test_language_settings(cx, &|language_settings| {language_settings.languages.0.insert("TOML".into(),LanguageSettingsContent {@@ -1454,7 +1454,7 @@ mod tests {init_test(cx, |_| {});- update_test_language_settings(cx, |language_settings| {+ update_test_language_settings(cx, &|language_settings| {language_settings.languages.0.insert("Rust".into(),LanguageSettingsContent {@@ -1576,7 +1576,7 @@ mod tests {init_test(cx, |_| {});- update_test_language_settings(cx, |language_settings| {+ update_test_language_settings(cx, &|language_settings| {language_settings.languages.0.insert("Rust".into(),LanguageSettingsContent {@@ -1742,7 +1742,7 @@ mod tests {init_test(cx, |_| {});- update_test_language_settings(cx, |language_settings| {+ update_test_language_settings(cx, &|language_settings| {language_settings.languages.0.insert("Rust".into(),LanguageSettingsContent {@@ -1850,7 +1850,7 @@ mod tests {async fn test_stopping_language_server_clears_semantic_tokens(cx: &mut TestAppContext) {init_test(cx, |_| {});- update_test_language_settings(cx, |language_settings| {+ update_test_language_settings(cx, &|language_settings| {language_settings.languages.0.insert("Rust".into(),LanguageSettingsContent {@@ -1928,7 +1928,7 @@ mod tests {async fn test_disabling_semantic_tokens_setting_clears_highlights(cx: &mut TestAppContext) {init_test(cx, |_| {});- update_test_language_settings(cx, |language_settings| {+ update_test_language_settings(cx, &|language_settings| {language_settings.languages.0.insert("Rust".into(),LanguageSettingsContent {@@ -1986,7 +1986,7 @@ mod tests {"Semantic tokens should be present before disabling the setting");- update_test_language_settings(&mut cx, |language_settings| {+ update_test_language_settings(&mut cx, &|language_settings| {language_settings.languages.0.insert("Rust".into(),LanguageSettingsContent {diff --git a/crates/inspector_ui/src/div_inspector.rs b/crates/inspector_ui/src/div_inspector.rsindex 18588d80e49..a7616e134a1 100644--- a/crates/inspector_ui/src/div_inspector.rs+++ b/crates/inspector_ui/src/div_inspector.rs@@ -401,19 +401,19 @@ impl DivInspector {..snapshot.clip_offset(usize::MAX, Bias::Left),).collect::<String>();- let mut method_names = split_str_with_ranges(&before_text, is_not_identifier_char)+ let mut method_names = split_str_with_ranges(&before_text, &is_not_identifier_char).into_iter().map(|(range, name)| (Some(range), name.to_string())).collect::<Vec<_>>();method_names.push((None, completion.clone()));method_names.extend(- split_str_with_ranges(&after_text, is_not_identifier_char)+ split_str_with_ranges(&after_text, &is_not_identifier_char).into_iter().map(|(range, name)| (Some(range), name.to_string())),);method_names} else {- split_str_with_ranges(&snapshot.text(), is_not_identifier_char)+ split_str_with_ranges(&snapshot.text(), &is_not_identifier_char).into_iter().map(|(range, name)| (Some(range), name.to_string())).collect::<Vec<_>>()diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rsindex daa5896909d..6b31c1d4dba 100644--- a/crates/project_panel/src/project_panel.rs+++ b/crates/project_panel/src/project_panel.rs@@ -2664,7 +2664,7 @@ impl ProjectPanel {let selection = self.find_entry(self.selection.as_ref(),true,- |entry, worktree_id| {+ &|entry: GitEntryRef, worktree_id: WorktreeId| {self.selection.is_none_or(|selection| {if selection.worktree_id == worktree_id {selection.entry_id != entry.id@@ -2703,7 +2703,7 @@ impl ProjectPanel {let selection = self.find_entry(self.selection.as_ref(),false,- |entry, worktree_id| {+ &|entry: GitEntryRef, worktree_id: WorktreeId| {self.selection.is_none_or(|selection| {if selection.worktree_id == worktree_id {selection.entry_id != entry.id@@ -2742,7 +2742,7 @@ impl ProjectPanel {let selection = self.find_entry(self.selection.as_ref(),true,- |entry, worktree_id| {+ &|entry: GitEntryRef, worktree_id: WorktreeId| {(self.selection.is_none()|| self.selection.is_some_and(|selection| {if selection.worktree_id == worktree_id {@@ -2780,7 +2780,7 @@ impl ProjectPanel {let selection = self.find_visible_entry(self.selection.as_ref(),true,- |entry, worktree_id| {+ &|entry: GitEntryRef, worktree_id: WorktreeId| {self.selection.is_none_or(|selection| {if selection.worktree_id == worktree_id {selection.entry_id != entry.id@@ -2808,7 +2808,7 @@ impl ProjectPanel {let selection = self.find_visible_entry(self.selection.as_ref(),false,- |entry, worktree_id| {+ &|entry: GitEntryRef, worktree_id: WorktreeId| {self.selection.is_none_or(|selection| {if selection.worktree_id == worktree_id {selection.entry_id != entry.id@@ -2836,7 +2836,7 @@ impl ProjectPanel {let selection = self.find_entry(self.selection.as_ref(),false,- |entry, worktree_id| {+ &|entry: GitEntryRef, worktree_id: WorktreeId| {self.selection.is_none_or(|selection| {if selection.worktree_id == worktree_id {selection.entry_id != entry.id@@ -4637,7 +4637,7 @@ impl ProjectPanel {worktree_id: WorktreeId,reverse_search: bool,only_visible_entries: bool,- predicate: impl Fn(GitEntryRef, WorktreeId) -> bool,+ predicate: &dyn Fn(GitEntryRef, WorktreeId) -> bool,cx: &mut Context<Self>,) -> Option<GitEntry> {if only_visible_entries {@@ -4680,7 +4680,7 @@ impl ProjectPanel {&self,start: Option<&SelectedEntry>,reverse_search: bool,- predicate: impl Fn(GitEntryRef, WorktreeId) -> bool,+ predicate: &dyn Fn(GitEntryRef, WorktreeId) -> bool,cx: &mut Context<Self>,) -> Option<SelectedEntry> {let mut worktree_ids: Vec<_> = self@@ -4797,7 +4797,7 @@ impl ProjectPanel {&self,start: Option<&SelectedEntry>,reverse_search: bool,- predicate: impl Fn(GitEntryRef, WorktreeId) -> bool,+ predicate: &dyn Fn(GitEntryRef, WorktreeId) -> bool,cx: &mut Context<Self>,) -> Option<SelectedEntry> {let mut worktree_ids: Vec<_> = selfdiff --git a/crates/sqlez/src/statement.rs b/crates/sqlez/src/statement.rsindex d08e58a6f93..5c9b963d924 100644--- a/crates/sqlez/src/statement.rs+++ b/crates/sqlez/src/statement.rs@@ -108,7 +108,7 @@ impl<'a> Statement<'a> {}}- fn bind_index_with(&self, index: i32, bind: impl Fn(&*mut sqlite3_stmt)) -> Result<()> {+ fn bind_index_with(&self, index: i32, bind: &dyn Fn(&*mut sqlite3_stmt)) -> Result<()> {let mut any_succeed = false;unsafe {for raw_statement in self.raw_statements.iter() {@@ -135,7 +135,7 @@ impl<'a> Statement<'a> {let blob_pointer = blob.as_ptr() as *const _;let len = blob.len() as c_int;- self.bind_index_with(index, |raw_statement| unsafe {+ self.bind_index_with(index, &|raw_statement| unsafe {sqlite3_bind_blob(*raw_statement, index, blob_pointer, len, SQLITE_TRANSIENT());})}@@ -161,7 +161,7 @@ impl<'a> Statement<'a> {pub fn bind_double(&self, index: i32, double: f64) -> Result<()> {let index = index as c_int;- self.bind_index_with(index, |raw_statement| unsafe {+ self.bind_index_with(index, &|raw_statement| unsafe {sqlite3_bind_double(*raw_statement, index, double);})}@@ -177,7 +177,7 @@ impl<'a> Statement<'a> {pub fn bind_int(&self, index: i32, int: i32) -> Result<()> {let index = index as c_int;- self.bind_index_with(index, |raw_statement| unsafe {+ self.bind_index_with(index, &|raw_statement| unsafe {sqlite3_bind_int(*raw_statement, index, int);})}@@ -193,7 +193,7 @@ impl<'a> Statement<'a> {pub fn bind_int64(&self, index: i32, int: i64) -> Result<()> {let index = index as c_int;- self.bind_index_with(index, |raw_statement| unsafe {+ self.bind_index_with(index, &|raw_statement| unsafe {sqlite3_bind_int64(*raw_statement, index, int);})}@@ -209,7 +209,7 @@ impl<'a> Statement<'a> {pub fn bind_null(&self, index: i32) -> Result<()> {let index = index as c_int;- self.bind_index_with(index, |raw_statement| unsafe {+ self.bind_index_with(index, &|raw_statement| unsafe {sqlite3_bind_null(*raw_statement, index);})}@@ -219,7 +219,7 @@ impl<'a> Statement<'a> {let text_pointer = text.as_ptr() as *const _;let len = text.len() as c_int;- self.bind_index_with(index, |raw_statement| unsafe {+ self.bind_index_with(index, &|raw_statement| unsafe {sqlite3_bind_text(*raw_statement, index, text_pointer, len, SQLITE_TRANSIENT());})}diff --git a/crates/terminal_view/src/terminal_path_like_target.rs b/crates/terminal_view/src/terminal_path_like_target.rsindex d6a10cd05f9..18eab6fc5b4 100644--- a/crates/terminal_view/src/terminal_path_like_target.rs+++ b/crates/terminal_view/src/terminal_path_like_target.rs@@ -109,7 +109,8 @@ fn possible_hover_target(.update(cx, |terminal_view, _| match file_to_open {Some(OpenTarget::File(path, _) | OpenTarget::Worktree(path, ..)) => {terminal_view.hover = Some(HoverTarget {- tooltip: path.to_string(|path| path.to_string_lossy().into_owned()),+ tooltip: path+ .to_string(&|path: &PathBuf| path.to_string_lossy().into_owned()),hovered_word,});}diff --git a/crates/util/src/paths.rs b/crates/util/src/paths.rsindex 4f018e6d192..5cc1a0c8ebc 100644--- a/crates/util/src/paths.rs+++ b/crates/util/src/paths.rs@@ -795,7 +795,7 @@ impl PathWithPosition {})}- pub fn to_string(&self, path_to_string: impl Fn(&PathBuf) -> String) -> String {+ pub fn to_string(&self, path_to_string: &dyn Fn(&PathBuf) -> String) -> String {let path_string = path_to_string(&self.path);if let Some(row) = self.row {if let Some(column) = self.column {diff --git a/crates/util/src/util.rs b/crates/util/src/util.rsindex bbcc323fd58..499ef71e1ac 100644--- a/crates/util/src/util.rs+++ b/crates/util/src/util.rs@@ -995,7 +995,10 @@ pub fn word_consists_of_emojis(s: &str) -> bool {/// Similar to `str::split`, but also provides byte-offset ranges of the results. Unlike/// `str::split`, this is not generic on pattern types and does not return an `Iterator`.-pub fn split_str_with_ranges(s: &str, pat: impl Fn(char) -> bool) -> Vec<(Range<usize>, &str)> {+pub fn split_str_with_ranges<'s>(+ s: &'s str,+ pat: &dyn Fn(char) -> bool,+) -> Vec<(Range<usize>, &'s str)> {let mut result = Vec::new();let mut start = 0;@@ -1358,13 +1361,13 @@ Line 3"##[test]fn test_split_with_ranges() {let input = "hi";- let result = split_str_with_ranges(input, |c| c == ' ');+ let result = split_str_with_ranges(input, &|c| c == ' ');assert_eq!(result.len(), 1);assert_eq!(result[0], (0..2, "hi"));let input = "héllo🦀world";- let result = split_str_with_ranges(input, |c| c == '🦀');+ let result = split_str_with_ranges(input, &|c| c == '🦀');assert_eq!(result.len(), 2);assert_eq!(result[0], (0..6, "héllo")); // 'é' is 2 bytesdiff --git a/crates/vim/src/helix/boundary.rs b/crates/vim/src/helix/boundary.rsindex 0c2ebbeef00..d93ca693b53 100644--- a/crates/vim/src/helix/boundary.rs+++ b/crates/vim/src/helix/boundary.rs@@ -378,7 +378,7 @@ impl ImmediateBoundary {impl BoundedObject for ImmediateBoundary {fn next_start(&self, map: &DisplaySnapshot, from: Offset, outer: bool) -> Option<Offset> {- try_find_boundary(map, from, |left, right| {+ try_find_boundary(map, from, &|left, right| {let classifier = map.buffer_snapshot().char_classifier_at(from.0);if outer {self.is_outer_start(left, right, classifier)@@ -388,7 +388,7 @@ impl BoundedObject for ImmediateBoundary {})}fn next_end(&self, map: &DisplaySnapshot, from: Offset, outer: bool) -> Option<Offset> {- try_find_boundary(map, from, |left, right| {+ try_find_boundary(map, from, &|left, right| {let classifier = map.buffer_snapshot().char_classifier_at(from.0);if outer {self.is_outer_end(left, right, classifier)@@ -398,7 +398,7 @@ impl BoundedObject for ImmediateBoundary {})}fn previous_start(&self, map: &DisplaySnapshot, from: Offset, outer: bool) -> Option<Offset> {- try_find_preceding_boundary(map, from, |left, right| {+ try_find_preceding_boundary(map, from, &|left, right| {let classifier = map.buffer_snapshot().char_classifier_at(from.0);if outer {self.is_outer_start(left, right, classifier)@@ -408,7 +408,7 @@ impl BoundedObject for ImmediateBoundary {})}fn previous_end(&self, map: &DisplaySnapshot, from: Offset, outer: bool) -> Option<Offset> {- try_find_preceding_boundary(map, from, |left, right| {+ try_find_preceding_boundary(map, from, &|left, right| {let classifier = map.buffer_snapshot().char_classifier_at(from.0);if outer {self.is_outer_end(left, right, classifier)@@ -460,7 +460,9 @@ impl FuzzyBoundary {return None;}Some(Box::new(|identifier, map| {- try_find_boundary(map, identifier, |left, right| left == '\n' && right != '\n')+ try_find_boundary(map, identifier, &|left, right| {+ left == '\n' && right != '\n'+ })}))}Self::Sentence => {@@ -497,7 +499,7 @@ impl FuzzyBoundary {return None;}Some(Box::new(|identifier, map| {- try_find_preceding_boundary(map, identifier, |left, right| {+ try_find_preceding_boundary(map, identifier, &|left, right| {left != '\n' && right == '\n'})}))@@ -629,7 +631,7 @@ impl BoundedObject for FuzzyBoundary {fn try_find_boundary(map: &DisplaySnapshot,from: Offset,- is_boundary: impl Fn(char, char) -> bool,+ is_boundary: &dyn Fn(char, char) -> bool,) -> Option<Offset> {let boundary = try_find_boundary_data(map, from, |left, right, point| {if is_boundary(left, right) {@@ -671,7 +673,7 @@ fn try_find_boundary_data<T>(fn try_find_preceding_boundary(map: &DisplaySnapshot,from: Offset,- is_boundary: impl Fn(char, char) -> bool,+ is_boundary: &dyn Fn(char, char) -> bool,) -> Option<Offset> {let boundary = try_find_preceding_boundary_data(map, from, |left, right, point| {if is_boundary(left, right) {diff --git a/crates/vim/src/helix/duplicate.rs b/crates/vim/src/helix/duplicate.rsindex 37796c57aa0..4823a2a0d57 100644--- a/crates/vim/src/helix/duplicate.rs+++ b/crates/vim/src/helix/duplicate.rs@@ -20,8 +20,8 @@ impl Vim {times,window,cx,- |prev_point| *prev_point.row_mut() += 1,- |prev_range, map| prev_range.end.row() >= map.max_point().row(),+ &|prev_point| *prev_point.row_mut() += 1,+ &|prev_range, map| prev_range.end.row() >= map.max_point().row(),false,);}@@ -38,8 +38,8 @@ impl Vim {times,window,cx,- |prev_point| *prev_point.row_mut() = prev_point.row().0.saturating_sub(1),- |prev_range, _| prev_range.start.row() == DisplayPoint::zero().row(),+ &|prev_point| *prev_point.row_mut() = prev_point.row().0.saturating_sub(1),+ &|prev_range, _| prev_range.start.row() == DisplayPoint::zero().row(),true,);}@@ -49,8 +49,8 @@ impl Vim {times: Option<usize>,window: &mut Window,cx: &mut Context<Self>,- advance_search: impl Fn(&mut DisplayPoint),- end_search: impl Fn(&Range<DisplayPoint>, &DisplaySnapshot) -> bool,+ advance_search: &dyn Fn(&mut DisplayPoint),+ end_search: &dyn Fn(&Range<DisplayPoint>, &DisplaySnapshot) -> bool,above: bool,) {let times = times.unwrap_or(1);diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rsindex 7b366141c5a..66e5eeb4734 100644--- a/crates/workspace/src/pane.rs+++ b/crates/workspace/src/pane.rs@@ -1148,7 +1148,7 @@ impl Pane {}};- self.close_items(window, cx, SaveIntent::Skip, |existing_item| {+ self.close_items(window, cx, SaveIntent::Skip, &|existing_item| {views_to_close.contains(&existing_item)}).detach();@@ -1621,7 +1621,7 @@ impl Pane {window: &mut Window,cx: &mut Context<Self>,) -> Task<Result<()>> {- self.close_items(window, cx, save_intent, move |view_id| {+ self.close_items(window, cx, save_intent, &move |view_id| {view_id == item_id_to_close})}@@ -1640,7 +1640,7 @@ impl Pane {.filter(|item| item.project_path(cx).as_ref() == Some(project_path)).map(|item| item.item_id()).collect();- self.close_items(window, cx, save_intent, move |item_id| {+ self.close_items(window, cx, save_intent, &move |item_id| {matching_item_ids.contains(&item_id)&& (close_pinned || !pinned_item_ids.contains(&item_id))})@@ -1670,7 +1670,7 @@ impl Pane {window,cx,action.save_intent.unwrap_or(SaveIntent::Close),- move |item_id| {+ &move |item_id| {item_id != active_item_id&& (action.close_pinned || !pinned_item_ids.contains(&item_id))},@@ -1694,7 +1694,7 @@ impl Pane {window,cx,action.save_intent.unwrap_or(SaveIntent::Close),- move |item_id| {+ &move |item_id| {(action.close_pinned || !pinned_item_ids.contains(&item_id))&& multibuffer_items.contains(&item_id)},@@ -1714,7 +1714,7 @@ impl Pane {let clean_item_ids = self.clean_item_ids(cx);let pinned_item_ids = self.pinned_item_ids();- self.close_items(window, cx, SaveIntent::Close, move |item_id| {+ self.close_items(window, cx, SaveIntent::Close, &move |item_id| {clean_item_ids.contains(&item_id)&& (action.close_pinned || !pinned_item_ids.contains(&item_id))})@@ -1756,7 +1756,7 @@ impl Pane {let to_the_side_item_ids = self.to_the_side_item_ids(item_id, side);let pinned_item_ids = self.pinned_item_ids();- self.close_items(window, cx, SaveIntent::Close, move |item_id| {+ self.close_items(window, cx, SaveIntent::Close, &move |item_id| {to_the_side_item_ids.contains(&item_id)&& (close_pinned || !pinned_item_ids.contains(&item_id))})@@ -1778,7 +1778,7 @@ impl Pane {window,cx,action.save_intent.unwrap_or(SaveIntent::Close),- |item_id| action.close_pinned || !pinned_item_ids.contains(&item_id),+ &|item_id| action.close_pinned || !pinned_item_ids.contains(&item_id),)}@@ -1911,7 +1911,7 @@ impl Pane {window: &mut Window,cx: &mut Context<Pane>,mut save_intent: SaveIntent,- should_close: impl Fn(EntityId) -> bool,+ should_close: &dyn Fn(EntityId) -> bool,) -> Task<Result<()>> {// Find the items to close.let mut items_to_close = Vec::new();diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rsindex 0e686c49d26..4db38daa2ae 100644--- a/crates/workspace/src/workspace.rs+++ b/crates/workspace/src/workspace.rs@@ -10049,7 +10049,7 @@ mod tests {let item1_id = item1.item_id();let item3_id = item3.item_id();let item4_id = item4.item_id();- pane.close_items(window, cx, SaveIntent::Close, move |id| {+ pane.close_items(window, cx, SaveIntent::Close, &move |id| {[item1_id, item3_id, item4_id].contains(&id)})});@@ -10347,7 +10347,7 @@ mod tests {// // Ensure auto save with delay saves the item on close, even if the timer hasn't yet run out.pane.update_in(cx, |pane, window, cx| {- pane.close_items(window, cx, SaveIntent::Close, move |id| id == item_id)+ pane.close_items(window, cx, SaveIntent::Close, &move |id| id == item_id)}).await.unwrap();@@ -10381,7 +10381,7 @@ mod tests {});pane.update_in(cx, |pane, window, cx| {- pane.close_items(window, cx, SaveIntent::Close, move |id| id == item_id)+ pane.close_items(window, cx, SaveIntent::Close, &move |id| id == item_id)}).await.unwrap();@@ -10404,7 +10404,7 @@ mod tests {// Ensure autosave is prevented for deleted files also when closing the buffer.let _close_items = pane.update_in(cx, |pane, window, cx| {- pane.close_items(window, cx, SaveIntent::Close, move |id| id == item_id)+ pane.close_items(window, cx, SaveIntent::Close, &move |id| id == item_id)});cx.run_until_parked();assert!(cx.has_pending_prompt());diff --git a/crates/zed/src/zed/windows_only_instance.rs b/crates/zed/src/zed/windows_only_instance.rsindex 14b08c8f669..5790715bc13 100644--- a/crates/zed/src/zed/windows_only_instance.rs+++ b/crates/zed/src/zed/windows_only_instance.rs@@ -45,7 +45,7 @@ pub fn handle_single_instance(opener: OpenListener, args: &Args) -> bool {std::thread::Builder::new().name("EnsureSingleton".to_owned()).spawn(move || {- with_pipe(|url| {+ with_pipe(&|url| {opener.open(RawOpenRequest {urls: vec![url],..Default::default()@@ -61,7 +61,7 @@ pub fn handle_single_instance(opener: OpenListener, args: &Args) -> bool {is_first_instance}-fn with_pipe(f: impl Fn(String)) {+fn with_pipe(f: &dyn Fn(String)) {let pipe = unsafe {CreateNamedPipeW(&HSTRING::from(format!("\\\\.\\pipe\\{}-Named-Pipe", app_identifier())),