From fba42df43bf36cd065a61772cc3022d96322fd14 Mon Sep 17 00:00:00 2001 From: Connor Skees Date: Wed, 21 Jul 2021 22:07:03 -0400 Subject: [PATCH] test for hue when largest channel is blue --- src/atrule/media.rs | 9 +++++---- tests/color.rs | 5 +++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/atrule/media.rs b/src/atrule/media.rs index c624061..d0507ea 100644 --- a/src/atrule/media.rs +++ b/src/atrule/media.rs @@ -47,6 +47,7 @@ impl MediaQuery { } } + #[allow(clippy::if_not_else)] fn merge(&self, other: &Self) -> MediaQueryMergeResult { let this_modifier = self.modifier.as_ref().map(|m| m.to_ascii_lowercase()); let this_type = self.media_type.as_ref().map(|m| m.to_ascii_lowercase()); @@ -91,12 +92,12 @@ impl MediaQuery { if negative_features .iter() - .all(|feat| positive_features.contains(&feat)) + .all(|feat| positive_features.contains(feat)) { return MediaQueryMergeResult::Empty; - } else { - return MediaQueryMergeResult::Unrepresentable; } + + return MediaQueryMergeResult::Unrepresentable; } else if self.matches_all_types() || other.matches_all_types() { return MediaQueryMergeResult::Unrepresentable; } @@ -173,7 +174,7 @@ impl MediaQuery { return MediaQueryMergeResult::Empty; } else { if this_modifier.is_some() { - modifier = &this_modifier + modifier = &this_modifier; } else { modifier = &other_modifier; } diff --git a/tests/color.rs b/tests/color.rs index 42a7b90..57c9654 100644 --- a/tests/color.rs +++ b/tests/color.rs @@ -788,3 +788,8 @@ test!( "a {\n color: mix(rgba(255, 20, 0, 0), rgba(0, 20, 255, 1), 100);\n}\n", "a {\n color: rgba(255, 20, 0, 0);\n}\n" ); +test!( + hue_largest_channel_is_blue, + "a {\n color: hue(rgb(1, 2, 5));\n}\n", + "a {\n color: 225deg;\n}\n" +);