refactor: remove_ansi to single liner

This commit is contained in:
Jack Wills
2022-12-09 03:42:32 +00:00
parent 1525b31502
commit 57c3a6c186
+1 -5
View File
@@ -41,11 +41,7 @@ pub mod log_sanitizer {
/// Remove all ansi formatting from a given string and create tui-rs spans /// Remove all ansi formatting from a given string and create tui-rs spans
pub fn remove_ansi<'a>(input: &str) -> Vec<Spans<'a>> { pub fn remove_ansi<'a>(input: &str) -> Vec<Spans<'a>> {
let mut output = String::new(); raw(&categorise_text(input).into_iter().map(|i|i.text).collect::<String>())
for i in categorise_text(input) {
output.push_str(i.text);
}
raw(&output)
} }
/// create tui-rs spans that exactly match the given strings /// create tui-rs spans that exactly match the given strings