diff options
author | Dan Davison <dandavison7@gmail.com> | 2021-12-06 21:00:48 -0500 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2021-12-09 20:46:28 -0500 |
commit | 9554f47ce9e79051ad7a3a9dfbdab7579003469d (patch) | |
tree | 3092eb8ff632ce62c2ec5a12e9ac3af73e722d9c /src/style.rs | |
parent | 354731b95a09b624ab17ab5729422125f95e24d0 (diff) |
Refactor
Ref #829
Diffstat (limited to 'src/style.rs')
-rw-r--r-- | src/style.rs | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/style.rs b/src/style.rs index 6ffb1f01..fe0da888 100644 --- a/src/style.rs +++ b/src/style.rs @@ -355,7 +355,7 @@ lazy_static! { }; } -pub fn line_has_style_other_than<'a>(line: &str, styles: impl Iterator<Item = &'a Style>) -> bool { +pub fn line_has_style_other_than(line: &str, styles: &[Style]) -> bool { if !ansi::string_starts_with_ansi_style_sequence(line) { return false; } @@ -443,38 +443,35 @@ pub mod tests { let plus_line_from_unconfigured_git = "\x1b[32m+\x1b[m\x1b[32m____\x1b[m\n"; // Unstyled lines should test negative, regardless of supplied styles. - assert!(!line_has_style_other_than("", [].iter())); - assert!(!line_has_style_other_than( - "", - [*GIT_DEFAULT_MINUS_STYLE].iter() - )); + assert!(!line_has_style_other_than("", &[])); + assert!(!line_has_style_other_than("", &[*GIT_DEFAULT_MINUS_STYLE])); // Lines from git should test negative when corresponding default is supplied assert!(!line_has_style_other_than( minus_line_from_unconfigured_git, - [*GIT_DEFAULT_MINUS_STYLE].iter() + &[*GIT_DEFAULT_MINUS_STYLE] )); assert!(!line_has_style_other_than( plus_line_from_unconfigured_git, - [*GIT_DEFAULT_PLUS_STYLE].iter() + &[*GIT_DEFAULT_PLUS_STYLE] )); // Styled lines should test positive when unless their style is supplied. assert!(line_has_style_other_than( minus_line_from_unconfigured_git, - [*GIT_DEFAULT_PLUS_STYLE].iter() + &[*GIT_DEFAULT_PLUS_STYLE] )); assert!(line_has_style_other_than( minus_line_from_unconfigured_git, - [].iter() + &[] )); assert!(line_has_style_other_than( plus_line_from_unconfigured_git, - [*GIT_DEFAULT_MINUS_STYLE].iter() + &[*GIT_DEFAULT_MINUS_STYLE] )); assert!(line_has_style_other_than( plus_line_from_unconfigured_git, - [].iter() + &[] )); } |