From 4d1d9df6a317bf3db9a978d162228d06f0ff5b43 Mon Sep 17 00:00:00 2001 From: 0xffff00 Date: Fri, 13 Feb 2026 22:09:04 +0100 Subject: [PATCH] perf: improved collection logic --- src/main.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 4016a33..dbfa669 100644 --- a/src/main.rs +++ b/src/main.rs @@ -32,9 +32,8 @@ fn remove_doubles(characters: &Vec) -> Vec { characters .iter() - .enumerate() - .filter(|(idx, _)| !shortenable_map[*idx]) - .map(|(_, itm)| *itm) + .zip(shortenable_map) + .filter_map(|(c, shortenable)| if shortenable { None } else { Some(*c) }) .collect() }