From 3dac4f7fa6451c446902583d2d2aa1358960fe7c Mon Sep 17 00:00:00 2001 From: Marco Ieni <11428655+MarcoIeni@users.noreply.github.com> Date: Fri, 6 Nov 2020 00:12:27 +0100 Subject: fix some clippy warnings (#380) --- src/style.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/style.rs') diff --git a/src/style.rs b/src/style.rs index 7bf56c71..d25fc2f7 100644 --- a/src/style.rs +++ b/src/style.rs @@ -1,7 +1,6 @@ use std::borrow::Cow; use std::fmt; -use ansi_term; use lazy_static::lazy_static; use crate::ansi; @@ -135,9 +134,8 @@ impl Style { } (false, None) => words.push("normal".to_string()), } - match self.ansi_term_style.background { - Some(color) => words.push(color::color_to_string(color)), - None => {} + if let Some(color) = self.ansi_term_style.background { + words.push(color::color_to_string(color)) } words.join(" ") } @@ -155,10 +153,10 @@ pub fn ansi_term_style_equality(a: ansi_term::Style, b: ansi_term::Style) -> boo ..b }; if a_attrs != b_attrs { - return false; + false } else { - return ansi_term_color_equality(a.foreground, b.foreground) - & ansi_term_color_equality(a.background, b.background); + ansi_term_color_equality(a.foreground, b.foreground) + & ansi_term_color_equality(a.background, b.background) } } @@ -211,7 +209,7 @@ pub fn line_has_style_other_than<'a>(line: &str, styles: impl Iterator