From c06847e48e8ad98161bc1409d386a6ccc7cc8534 Mon Sep 17 00:00:00 2001 From: Marco Mihai Condrache <52580954+marcocondrache@users.noreply.github.com> Date: Mon, 2 Feb 2026 18:05:11 +0100 Subject: [PATCH] language: Avoid cloning of the previous tree_sitter::Tree (#48197) The parsing text function used the old tree only as a ref so it doesn't make sense to clone it. Release Notes: - N/A --- crates/language/src/syntax_map.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/language/src/syntax_map.rs b/crates/language/src/syntax_map.rs index ee8765835efdd94cce598e1c58731da2046e65b2..2922e359d2b8f610a3c4ffb365270eb94cc4f50c 100644 --- a/crates/language/src/syntax_map.rs +++ b/crates/language/src/syntax_map.rs @@ -702,7 +702,7 @@ impl SyntaxSnapshot { text.as_rope(), step_start_byte, &included_ranges, - Some(old_tree.clone()), + Some(old_tree), budget, ); match result { @@ -1450,7 +1450,7 @@ fn parse_text( text: &Rope, start_byte: usize, ranges: &[tree_sitter::Range], - old_tree: Option, + old_tree: Option<&tree_sitter::Tree>, parse_budget: &mut Option, ) -> anyhow::Result { with_parser(|parser| { @@ -1478,7 +1478,7 @@ fn parse_text( chunks.seek(start_byte + offset); chunks.next().unwrap_or("").as_bytes() }, - old_tree.as_ref(), + old_tree, progress_callback .as_mut() .map(|progress_callback| tree_sitter::ParseOptions {