From 0df1eb71cb7665bac174c0fdb2764d6690af8bf9 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 17 Oct 2023 05:08:56 +0200 Subject: [PATCH] Use cloned --- crates/gpui3/src/text_system.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/crates/gpui3/src/text_system.rs b/crates/gpui3/src/text_system.rs index a50cbffc6cfe8619fbd8526e41af204f54d310e2..e6395c40223297e4871a7bec073eae97f2e856ba 100644 --- a/crates/gpui3/src/text_system.rs +++ b/crates/gpui3/src/text_system.rs @@ -152,10 +152,7 @@ impl TextSystem { runs: &[(usize, RunStyle)], wrap_width: Option, ) -> Result; 1]>> { - let mut runs = runs - .iter() - .map(|(run_len, style)| (*run_len, style)) - .peekable(); + let mut runs = runs.iter().cloned().peekable(); let mut font_runs: Vec<(usize, FontId)> = self.font_runs_pool.lock().pop().unwrap_or_default(); @@ -164,7 +161,7 @@ impl TextSystem { for line in text.split('\n') { let line_end = line_start + line.len(); - let mut last_font: Option<&Font> = None; + let mut last_font: Option = None; let mut decoration_runs = SmallVec::<[DecorationRun; 32]>::new(); let mut run_start = line_start; while run_start < line_end { @@ -174,10 +171,10 @@ impl TextSystem { let run_len_within_line = cmp::min(line_end, run_start + *run_len) - run_start; - if last_font == Some(&run_style.font) { + if last_font == Some(run_style.font.clone()) { font_runs.last_mut().unwrap().0 += run_len_within_line; } else { - last_font = Some(&run_style.font); + last_font = Some(run_style.font.clone()); font_runs.push(( run_len_within_line, self.platform_text_system.font_id(&run_style.font)?,