chore: linting pedantic
This commit is contained in:
@@ -7,9 +7,9 @@ pub mod log_sanitizer {
|
||||
};
|
||||
|
||||
/// Attempt to colorize the given string to tui-rs standars
|
||||
pub fn colorize_logs(input: String) -> Vec<Spans<'static>> {
|
||||
pub fn colorize_logs(input: &str) -> Vec<Spans<'static>> {
|
||||
vec![Spans::from(
|
||||
categorise_text(&input)
|
||||
categorise_text(input)
|
||||
.into_iter()
|
||||
.map(|i| {
|
||||
let fg_color = color_ansi_to_tui(i.fg.unwrap_or(CansiColor::White));
|
||||
@@ -40,10 +40,10 @@ pub mod log_sanitizer {
|
||||
}
|
||||
|
||||
/// Remove all ansi formatting from a given string and create tui-rs spans
|
||||
pub fn remove_ansi(input: String) -> Vec<Spans<'static>> {
|
||||
pub fn remove_ansi(input: &str) -> Vec<Spans<'static>> {
|
||||
let mut output = String::from("");
|
||||
for i in categorise_text(&input) {
|
||||
output.push_str(i.text)
|
||||
for i in categorise_text(input) {
|
||||
output.push_str(i.text);
|
||||
}
|
||||
raw(output)
|
||||
}
|
||||
@@ -56,22 +56,20 @@ pub mod log_sanitizer {
|
||||
/// Change from ansi to tui colors
|
||||
fn color_ansi_to_tui(color: CansiColor) -> Color {
|
||||
match color {
|
||||
CansiColor::Black => Color::Black,
|
||||
CansiColor::Black | CansiColor::BrightBlack => Color::Black,
|
||||
CansiColor::Red => Color::Red,
|
||||
CansiColor::Green => Color::Green,
|
||||
CansiColor::Yellow => Color::Yellow,
|
||||
CansiColor::Blue => Color::Blue,
|
||||
CansiColor::Magenta => Color::Magenta,
|
||||
CansiColor::Cyan => Color::Cyan,
|
||||
CansiColor::White => Color::White,
|
||||
CansiColor::BrightBlack => Color::Black,
|
||||
CansiColor::White | CansiColor::BrightWhite => Color::White,
|
||||
CansiColor::BrightRed => Color::LightRed,
|
||||
CansiColor::BrightGreen => Color::LightGreen,
|
||||
CansiColor::BrightYellow => Color::LightYellow,
|
||||
CansiColor::BrightBlue => Color::LightBlue,
|
||||
CansiColor::BrightMagenta => Color::LightMagenta,
|
||||
CansiColor::BrightCyan => Color::LightCyan,
|
||||
CansiColor::BrightWhite => Color::White,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user