From 365c5ab45ffdc3d94a3d89dfbe32fb6bf45d3010 Mon Sep 17 00:00:00 2001 From: Finn Evers Date: Tue, 9 Sep 2025 10:04:27 +0200 Subject: [PATCH] editor: Remove unnecessary clone (#37833) The style is taken by reference everywhere, so no need to clone it at the start of every `prepaint`. Release Notes: - N/A --- crates/editor/src/element.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index d8260dd2392f5e137b518bab7fb283ee9452bdd1..a702d5b74f7d995a8aa29e35fecbed3cadabeba4 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -8298,7 +8298,7 @@ impl Element for EditorElement { let (mut snapshot, is_read_only) = self.editor.update(cx, |editor, cx| { (editor.snapshot(window, cx), editor.read_only(cx)) }); - let style = self.style.clone(); + let style = &self.style; let rem_size = window.rem_size(); let font_id = window.text_system().resolve_font(&style.text.font()); @@ -8773,7 +8773,7 @@ impl Element for EditorElement { blame.blame_for_rows(&[row_infos], cx).next() }) .flatten()?; - let mut element = render_inline_blame_entry(blame_entry, &style, cx)?; + let mut element = render_inline_blame_entry(blame_entry, style, cx)?; let inline_blame_padding = ProjectSettings::get_global(cx) .git .inline_blame @@ -8793,7 +8793,7 @@ impl Element for EditorElement { let longest_line_width = layout_line( snapshot.longest_row(), &snapshot, - &style, + style, editor_width, is_row_soft_wrapped, window, @@ -8951,7 +8951,7 @@ impl Element for EditorElement { scroll_pixel_position, newest_selection_head, editor_width, - &style, + style, window, cx, ) @@ -8969,7 +8969,7 @@ impl Element for EditorElement { end_row, line_height, em_width, - &style, + style, window, cx, ); @@ -9114,7 +9114,7 @@ impl Element for EditorElement { &line_layouts, newest_selection_head, newest_selection_point, - &style, + style, window, cx, )