aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2017-05-18 12:32:10 +0200
committerSimon Sapin <simon.sapin@exyr.org>2017-05-18 17:13:19 +0200
commitc06e574c186b17b9c49cf78ac6cd0daef679a3e3 (patch)
tree818e0340de1fbe5c2a69ba42fe48bb75604bff17 /components
parent76166bce585cfcbe8bea4fa2538fec2ec34ca90e (diff)
downloadservo-c06e574c186b17b9c49cf78ac6cd0daef679a3e3.tar.gz
servo-c06e574c186b17b9c49cf78ac6cd0daef679a3e3.zip
Short-circuit and unindent
Diffstat (limited to 'components')
-rw-r--r--components/selectors/matching.rs60
1 files changed, 29 insertions, 31 deletions
diff --git a/components/selectors/matching.rs b/components/selectors/matching.rs
index e5e130aeaeb..50b686f2558 100644
--- a/components/selectors/matching.rs
+++ b/components/selectors/matching.rs
@@ -427,44 +427,42 @@ fn matches_simple_selector<E, F>(
never_matches,
} => {
if never_matches {
- false
- } else {
- let is_html = element.is_html_element_in_html_document();
- element.attr_matches(
- &NamespaceConstraint::Specific(&::parser::namespace_empty_string::<E::Impl>()),
- select_name(is_html, local_name, local_name_lower),
- &AttrSelectorOperation::WithValue {
- operator: operator,
- case_sensitivity: case_sensitivity.to_unconditional(is_html),
- expected_value: value,
- }
- )
+ return false
}
+ let is_html = element.is_html_element_in_html_document();
+ element.attr_matches(
+ &NamespaceConstraint::Specific(&::parser::namespace_empty_string::<E::Impl>()),
+ select_name(is_html, local_name, local_name_lower),
+ &AttrSelectorOperation::WithValue {
+ operator: operator,
+ case_sensitivity: case_sensitivity.to_unconditional(is_html),
+ expected_value: value,
+ }
+ )
}
Component::AttributeOther(ref attr_sel) => {
if attr_sel.never_matches {
return false
- } else {
- let is_html = element.is_html_element_in_html_document();
- element.attr_matches(
- &attr_sel.namespace(),
- select_name(is_html, &attr_sel.local_name, &attr_sel.local_name_lower),
- &match attr_sel.operation {
- ParsedAttrSelectorOperation::Exists => AttrSelectorOperation::Exists,
- ParsedAttrSelectorOperation::WithValue {
- operator,
- case_sensitivity,
- ref expected_value,
- } => {
- AttrSelectorOperation::WithValue {
- operator: operator,
- case_sensitivity: case_sensitivity.to_unconditional(is_html),
- expected_value: expected_value,
- }
+ }
+ let is_html = element.is_html_element_in_html_document();
+ element.attr_matches(
+ &attr_sel.namespace(),
+ select_name(is_html, &attr_sel.local_name, &attr_sel.local_name_lower),
+ &match attr_sel.operation {
+ ParsedAttrSelectorOperation::Exists => AttrSelectorOperation::Exists,
+ ParsedAttrSelectorOperation::WithValue {
+ operator,
+ case_sensitivity,
+ ref expected_value,
+ } => {
+ AttrSelectorOperation::WithValue {
+ operator: operator,
+ case_sensitivity: case_sensitivity.to_unconditional(is_html),
+ expected_value: expected_value,
}
}
- )
- }
+ }
+ )
}
Component::NonTSPseudoClass(ref pc) => {
element.match_non_ts_pseudo_class(pc, context, flags_setter)