From 57c3a6c186b916faba24bf7b5cdbbda31d636a7e Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Fri, 9 Dec 2022 03:42:32 +0000 Subject: [PATCH] refactor: remove_ansi to single liner --- src/ui/color_match.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/ui/color_match.rs b/src/ui/color_match.rs index 8ad3112..de0eeb6 100644 --- a/src/ui/color_match.rs +++ b/src/ui/color_match.rs @@ -41,11 +41,7 @@ pub mod log_sanitizer { /// Remove all ansi formatting from a given string and create tui-rs spans pub fn remove_ansi<'a>(input: &str) -> Vec> { - let mut output = String::new(); - for i in categorise_text(input) { - output.push_str(i.text); - } - raw(&output) + raw(&categorise_text(input).into_iter().map(|i|i.text).collect::()) } /// create tui-rs spans that exactly match the given strings