Short-circuit and unindent

This commit is contained in:
Simon Sapin 2017-05-18 12:32:10 +02:00
parent 76166bce58
commit c06e574c18

View file

@ -427,44 +427,42 @@ fn matches_simple_selector<E, F>(
never_matches, never_matches,
} => { } => {
if never_matches { if never_matches {
false return 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,
}
)
} }
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) => { Component::AttributeOther(ref attr_sel) => {
if attr_sel.never_matches { if attr_sel.never_matches {
return false return false
} else { }
let is_html = element.is_html_element_in_html_document(); let is_html = element.is_html_element_in_html_document();
element.attr_matches( element.attr_matches(
&attr_sel.namespace(), &attr_sel.namespace(),
select_name(is_html, &attr_sel.local_name, &attr_sel.local_name_lower), select_name(is_html, &attr_sel.local_name, &attr_sel.local_name_lower),
&match attr_sel.operation { &match attr_sel.operation {
ParsedAttrSelectorOperation::Exists => AttrSelectorOperation::Exists, ParsedAttrSelectorOperation::Exists => AttrSelectorOperation::Exists,
ParsedAttrSelectorOperation::WithValue { ParsedAttrSelectorOperation::WithValue {
operator, operator,
case_sensitivity, case_sensitivity,
ref expected_value, ref expected_value,
} => { } => {
AttrSelectorOperation::WithValue { AttrSelectorOperation::WithValue {
operator: operator, operator: operator,
case_sensitivity: case_sensitivity.to_unconditional(is_html), case_sensitivity: case_sensitivity.to_unconditional(is_html),
expected_value: expected_value, expected_value: expected_value,
}
} }
} }
) }
} )
} }
Component::NonTSPseudoClass(ref pc) => { Component::NonTSPseudoClass(ref pc) => {
element.match_non_ts_pseudo_class(pc, context, flags_setter) element.match_non_ts_pseudo_class(pc, context, flags_setter)