diff --git a/wezterm-gui/src/shapecache.rs b/wezterm-gui/src/shapecache.rs index b1a0b3d69..d62c87c41 100644 --- a/wezterm-gui/src/shapecache.rs +++ b/wezterm-gui/src/shapecache.rs @@ -50,7 +50,7 @@ where infos: &[GlyphInfo], glyphs: &[Rc>], ) -> Vec> { - let mut pos: Vec>> = vec![]; + let mut pos: Vec>> = Vec::with_capacity(infos.len()); let mut x = 0.; let mut prior_info: Option<&GlyphInfo> = None; diff --git a/wezterm-gui/src/termwindow/render.rs b/wezterm-gui/src/termwindow/render.rs index ab65fbb5a..a59aee423 100644 --- a/wezterm-gui/src/termwindow/render.rs +++ b/wezterm-gui/src/termwindow/render.rs @@ -1275,7 +1275,7 @@ impl super::TermWindow { glyph_cache: &mut GlyphCache, infos: &[GlyphInfo], ) -> anyhow::Result>>> { - let mut glyphs = vec![]; + let mut glyphs = Vec::with_capacity(infos.len()); for info in infos { let cell_idx = cluster.byte_to_cell_idx[info.cluster as usize]; let followed_by_space = match line.cells().get(cell_idx + 1) {