1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:37:43 +00:00

Libraries: Fix -Wunreachable-code warnings from clang

This commit is contained in:
Nico Weber 2021-10-08 08:34:12 -04:00 committed by Andreas Kling
parent 96666f3209
commit b8dc3661ac
10 changed files with 7 additions and 27 deletions

View file

@ -30,27 +30,20 @@ static bool matches_attribute(CSS::Selector::SimpleSelector::Attribute const& at
switch (attribute.match_type) {
case CSS::Selector::SimpleSelector::Attribute::MatchType::HasAttribute:
return element.has_attribute(attribute.name);
break;
case CSS::Selector::SimpleSelector::Attribute::MatchType::ExactValueMatch:
return element.attribute(attribute.name) == attribute.value;
break;
case CSS::Selector::SimpleSelector::Attribute::MatchType::ContainsWord:
return element.attribute(attribute.name).split_view(' ').contains_slow(attribute.value);
break;
case CSS::Selector::SimpleSelector::Attribute::MatchType::ContainsString:
return element.attribute(attribute.name).contains(attribute.value);
break;
case CSS::Selector::SimpleSelector::Attribute::MatchType::StartsWithSegment: {
auto segments = element.attribute(attribute.name).split_view('-');
return !segments.is_empty() && segments.first() == attribute.value;
break;
}
case CSS::Selector::SimpleSelector::Attribute::MatchType::StartsWithString:
return element.attribute(attribute.name).starts_with(attribute.value);
break;
case CSS::Selector::SimpleSelector::Attribute::MatchType::EndsWithString:
return element.attribute(attribute.name).ends_with(attribute.value);
break;
case CSS::Selector::SimpleSelector::Attribute::MatchType::None:
VERIFY_NOT_REACHED();
break;