Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

editor: Remove redundant clone in `highlight_text` (#49810)

ᴀᴍᴛᴏᴀᴇʀ5901d580a9f6
diff --git a/crates/editor/src/display_map.rs b/crates/editor/src/display_map.rs
index 99db360e17b..9bdff7776ce 100644
--- a/crates/editor/src/display_map.rs
+++ b/crates/editor/src/display_map.rs
@@ -1216,7 +1216,7 @@ impl DisplayMap {
let to_insert = match self.text_highlights.remove(&key) {
Some(mut previous) if merge => match Arc::get_mut(&mut previous) {
Some((_, previous_ranges)) => {
- previous_ranges.extend(ranges.iter().cloned());
+ previous_ranges.extend(ranges);
previous_ranges.sort_by(|a, b| a.start.cmp(&b.start, &multi_buffer_snapshot));
previous
}