aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBobby Holley <bobbyholley@gmail.com>2017-02-07 22:56:01 -0800
committerBobby Holley <bobbyholley@gmail.com>2017-02-07 23:01:06 -0800
commita69eed69564f44e047e8340b95de9a23c9717307 (patch)
treebbe727fd12122e58dc8c7425e594becb61678cdf
parent8915e53cee422f3c34d6882afa0e2b7746f239fc (diff)
downloadservo-a69eed69564f44e047e8340b95de9a23c9717307.tar.gz
servo-a69eed69564f44e047e8340b95de9a23c9717307.zip
Fixes to pass tidy.
-rw-r--r--components/selectors/matching.rs14
-rw-r--r--components/selectors/parser.rs8
-rw-r--r--components/selectors/tree.rs1
-rw-r--r--servo-tidy.toml3
4 files changed, 14 insertions, 12 deletions
diff --git a/components/selectors/matching.rs b/components/selectors/matching.rs
index 72d3a21ebf2..e4c13bf83fb 100644
--- a/components/selectors/matching.rs
+++ b/components/selectors/matching.rs
@@ -1,12 +1,10 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-use std::borrow::Borrow;
-
use bloom::BloomFilter;
-
use parser::{CaseSensitivity, Combinator, ComplexSelector, LocalName};
use parser::{SimpleSelector, Selector, SelectorImpl};
+use std::borrow::Borrow;
use tree::Element;
/// The reason why we're doing selector matching.
@@ -240,8 +238,8 @@ fn can_fast_reject<E>(mut selector: &ComplexSelector<E::Impl>,
for ss in selector.compound_selector.iter() {
match *ss {
SimpleSelector::LocalName(LocalName { ref name, ref lower_name }) => {
- if !bf.might_contain(name)
- && !bf.might_contain(lower_name) {
+ if !bf.might_contain(name) &&
+ !bf.might_contain(lower_name) {
return Some(SelectorMatchingResult::NotMatchedGlobally);
}
},
@@ -320,7 +318,8 @@ fn matches_complex_selector_internal<E>(selector: &ComplexSelector<E::Impl>,
// If the failure status is NotMatchedAndRestartFromClosestDescendant
// and combinator is Combinator::LaterSibling, give up this Combinator::LaterSibling matching
// and restart from the closest descendant combinator.
- (SelectorMatchingResult::NotMatchedAndRestartFromClosestDescendant, Combinator::LaterSibling) => return result,
+ (SelectorMatchingResult::NotMatchedAndRestartFromClosestDescendant, Combinator::LaterSibling)
+ => return result,
// The Combinator::Descendant combinator and the status is
// NotMatchedAndRestartFromClosestLaterSibling or
@@ -436,7 +435,8 @@ fn matches_simple_selector<E>(
relation_if!(matches_last_child(element, reason), AFFECTED_BY_CHILD_INDEX)
}
SimpleSelector::OnlyChild => {
- relation_if!(matches_first_child(element, reason) && matches_last_child(element, reason), AFFECTED_BY_CHILD_INDEX)
+ relation_if!(matches_first_child(element, reason) &&
+ matches_last_child(element, reason), AFFECTED_BY_CHILD_INDEX)
}
SimpleSelector::Root => {
// We never share styles with an element with no parent, so no point
diff --git a/components/selectors/parser.rs b/components/selectors/parser.rs
index a3862265bda..d5cae30042f 100644
--- a/components/selectors/parser.rs
+++ b/components/selectors/parser.rs
@@ -574,7 +574,7 @@ impl From<Specificity> for u32 {
fn specificity<Impl>(complex_selector: &ComplexSelector<Impl>,
pseudo_element: Option<&Impl::PseudoElement>)
-> u32
- where Impl: SelectorImpl {
+ where Impl: SelectorImpl {
let mut specificity = complex_selector_specificity(complex_selector);
if pseudo_element.is_some() {
specificity.element_selectors += 1;
@@ -670,7 +670,7 @@ fn parse_complex_selector_and_pseudo_element<P, Impl>(
where P: Parser<Impl=Impl>, Impl: SelectorImpl
{
let (first, mut pseudo_element) = parse_compound_selector(parser, input)?;
- let mut complex = ComplexSelector{ compound_selector: first, next: None };
+ let mut complex = ComplexSelector { compound_selector: first, next: None };
'outer_loop: while pseudo_element.is_none() {
let combinator;
@@ -1123,11 +1123,11 @@ fn parse_simple_pseudo_class<P, Impl>(parser: &P, name: Cow<str>) -> Result<Simp
// NB: pub module in order to access the DummyParser
#[cfg(test)]
pub mod tests {
+ use cssparser::{Parser as CssParser, ToCss, serialize_identifier};
use std::borrow::Cow;
use std::collections::HashMap;
use std::fmt;
use std::sync::Arc;
- use cssparser::{Parser as CssParser, ToCss, serialize_identifier};
use super::*;
#[derive(PartialEq, Clone, Debug, Hash, Eq)]
@@ -1219,7 +1219,7 @@ pub mod tests {
self.default_ns.clone()
}
- fn namespace_for_prefix(&self, prefix: &String) -> Option<String> {
+ fn namespace_for_prefix(&self, prefix: &str) -> Option<String> {
self.ns_prefixes.get(prefix).cloned()
}
}
diff --git a/components/selectors/tree.rs b/components/selectors/tree.rs
index 0ef48b4eec3..850b58a6b2c 100644
--- a/components/selectors/tree.rs
+++ b/components/selectors/tree.rs
@@ -86,7 +86,6 @@ impl<T> MatchAttr for T where T: MatchAttrGeneric, T::Impl: SelectorImpl<AttrVal
fn match_attr_dash(&self, attr: &AttrSelector<Self::Impl>, value: &String) -> bool {
self.match_attr(attr, |attr_value| {
-
// The attribute must start with the pattern.
if !attr_value.starts_with(value) {
return false
diff --git a/servo-tidy.toml b/servo-tidy.toml
index b42cc23b619..6c0b63f6951 100644
--- a/servo-tidy.toml
+++ b/servo-tidy.toml
@@ -50,6 +50,9 @@ files = [
"./tests/wpt/mozilla/tests/css/fonts",
"./tests/wpt/mozilla/tests/css/pre_with_tab.html",
"./tests/wpt/mozilla/tests/mozilla/textarea_placeholder.html",
+ # Tidy complains about taking &String instead of &str, but they aren't
+ # equivalent given the way the traits are set up.
+ "./components/selectors/tree.rs",
]
# Directories that are ignored for the non-WPT tidy check.
directories = [