diff options
| author | Valentin Anger <syrupthinker@gryphno.de> | 2020-06-29 14:17:37 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-29 14:17:37 +0200 |
| commit | db36857288609858ada259444509a31637980ce3 (patch) | |
| tree | 9fc83f32408941bdf75d803b4b0dbffe297c10f2 /cli/colors.rs | |
| parent | 0374eadcf7ecb054dae1b1587843a2006fdf4c2d (diff) | |
refactor: util functions take slices instead of heap values (#6547)
Diffstat (limited to 'cli/colors.rs')
| -rw-r--r-- | cli/colors.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/cli/colors.rs b/cli/colors.rs index b9a5a7353..ccbcc926a 100644 --- a/cli/colors.rs +++ b/cli/colors.rs @@ -46,85 +46,85 @@ fn style(s: &str, colorspec: ColorSpec) -> impl fmt::Display { String::from_utf8_lossy(&v).into_owned() } -pub fn red_bold(s: String) -> impl fmt::Display { +pub fn red_bold(s: &str) -> impl fmt::Display { let mut style_spec = ColorSpec::new(); style_spec.set_fg(Some(Red)).set_bold(true); style(&s, style_spec) } -pub fn green_bold(s: String) -> impl fmt::Display { +pub fn green_bold(s: &str) -> impl fmt::Display { let mut style_spec = ColorSpec::new(); style_spec.set_fg(Some(Ansi256(10))).set_bold(true); style(&s, style_spec) } -pub fn italic_bold(s: String) -> impl fmt::Display { +pub fn italic_bold(s: &str) -> impl fmt::Display { let mut style_spec = ColorSpec::new(); style_spec.set_bold(true).set_italic(true); style(&s, style_spec) } -pub fn black_on_white(s: String) -> impl fmt::Display { +pub fn black_on_white(s: &str) -> impl fmt::Display { let mut style_spec = ColorSpec::new(); style_spec.set_bg(Some(White)).set_fg(Some(Black)); style(&s, style_spec) } -pub fn white_on_red(s: String) -> impl fmt::Display { +pub fn white_on_red(s: &str) -> impl fmt::Display { let mut style_spec = ColorSpec::new(); style_spec.set_bg(Some(Red)).set_fg(Some(White)); style(&s, style_spec) } -pub fn white_on_green(s: String) -> impl fmt::Display { +pub fn white_on_green(s: &str) -> impl fmt::Display { let mut style_spec = ColorSpec::new(); style_spec.set_bg(Some(Ansi256(10))).set_fg(Some(White)); style(&s, style_spec) } -pub fn yellow(s: String) -> impl fmt::Display { +pub fn yellow(s: &str) -> impl fmt::Display { let mut style_spec = ColorSpec::new(); style_spec.set_fg(Some(Ansi256(11))); style(&s, style_spec) } -pub fn cyan(s: String) -> impl fmt::Display { +pub fn cyan(s: &str) -> impl fmt::Display { let mut style_spec = ColorSpec::new(); style_spec.set_fg(Some(Ansi256(14))); style(&s, style_spec) } -pub fn red(s: String) -> impl fmt::Display { +pub fn red(s: &str) -> impl fmt::Display { let mut style_spec = ColorSpec::new(); style_spec.set_fg(Some(Red)); style(&s, style_spec) } -pub fn green(s: String) -> impl fmt::Display { +pub fn green(s: &str) -> impl fmt::Display { let mut style_spec = ColorSpec::new(); style_spec.set_fg(Some(Ansi256(10))); style(&s, style_spec) } -pub fn magenta(s: String) -> impl fmt::Display { +pub fn magenta(s: &str) -> impl fmt::Display { let mut style_spec = ColorSpec::new(); style_spec.set_fg(Some(Magenta)); style(&s, style_spec) } -pub fn bold(s: String) -> impl fmt::Display { +pub fn bold(s: &str) -> impl fmt::Display { let mut style_spec = ColorSpec::new(); style_spec.set_bold(true); style(&s, style_spec) } -pub fn gray(s: String) -> impl fmt::Display { +pub fn gray(s: &str) -> impl fmt::Display { let mut style_spec = ColorSpec::new(); style_spec.set_fg(Some(Ansi256(8))); style(&s, style_spec) } -pub fn italic_bold_gray(s: String) -> impl fmt::Display { +pub fn italic_bold_gray(s: &str) -> impl fmt::Display { let mut style_spec = ColorSpec::new(); style_spec .set_fg(Some(Ansi256(8))) |
