style: Remove unneeded bounds in SelectorMap and related code.

MozReview-Commit-ID: CWwdVCwWijn
This commit is contained in:
Emilio Cobos Álvarez 2017-07-13 02:45:06 +02:00
parent ebfc8f5858
commit 9394ea9644
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 4 additions and 27 deletions

View file

@ -109,10 +109,6 @@ impl SelectorMapEntry for Dependency {
fn selector(&self) -> SelectorIter<SelectorImpl> {
self.selector.iter_from(self.selector_offset)
}
fn hashes(&self) -> &AncestorHashes {
&self.hashes
}
}
/// The same, but for state selectors, which can track more exactly what state
@ -128,11 +124,7 @@ pub struct StateDependency {
impl SelectorMapEntry for StateDependency {
fn selector(&self) -> SelectorIter<SelectorImpl> {
self.dep.selector.iter_from(self.dep.selector_offset)
}
fn hashes(&self) -> &AncestorHashes {
&self.dep.hashes
self.dep.selector()
}
}

View file

@ -14,7 +14,7 @@ use pdqsort::sort_by;
use rule_tree::CascadeLevel;
use selector_parser::SelectorImpl;
use selectors::matching::{matches_selector, MatchingContext, ElementSelectorFlags};
use selectors::parser::{AncestorHashes, Component, Combinator, SelectorAndHashes, SelectorIter};
use selectors::parser::{Component, Combinator, SelectorAndHashes, SelectorIter};
use selectors::parser::LocalName as LocalNameSelector;
use smallvec::VecLike;
use std::collections::HashMap;
@ -26,19 +26,12 @@ use stylist::Rule;
pub trait SelectorMapEntry : Sized + Clone {
/// Gets the selector we should use to index in the selector map.
fn selector(&self) -> SelectorIter<SelectorImpl>;
/// Gets the ancestor hashes associated with the selector.
fn hashes(&self) -> &AncestorHashes;
}
impl SelectorMapEntry for SelectorAndHashes<SelectorImpl> {
fn selector(&self) -> SelectorIter<SelectorImpl> {
self.selector.iter()
}
fn hashes(&self) -> &AncestorHashes {
&self.hashes
}
}
/// Map element data to selector-providing objects for which the last simple
@ -65,7 +58,7 @@ impl SelectorMapEntry for SelectorAndHashes<SelectorImpl> {
/// TODO: Tune the initial capacity of the HashMap
#[derive(Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct SelectorMap<T: SelectorMapEntry> {
pub struct SelectorMap<T> {
/// A hash from an ID to rules which contain that ID selector.
pub id_hash: MaybeCaseInsensitiveHashMap<Atom, Vec<T>>,
/// A hash from a class name to rules which contain that class selector.
@ -83,7 +76,7 @@ fn sort_by_key<T, F: Fn(&T) -> K, K: Ord>(v: &mut [T], f: F) {
sort_by(v, |a, b| f(a).cmp(&f(b)))
}
impl<T: SelectorMapEntry> SelectorMap<T> {
impl<T> SelectorMap<T> {
/// Trivially constructs an empty `SelectorMap`.
pub fn new() -> Self {
SelectorMap {

View file

@ -1461,10 +1461,6 @@ impl SelectorMapEntry for RevalidationSelectorAndHashes {
fn selector(&self) -> SelectorIter<SelectorImpl> {
self.selector.iter_from(self.selector_offset)
}
fn hashes(&self) -> &AncestorHashes {
&self.hashes
}
}
/// Visitor to determine whether a selector requires cache revalidation.
@ -1609,10 +1605,6 @@ impl SelectorMapEntry for Rule {
fn selector(&self) -> SelectorIter<SelectorImpl> {
self.selector.iter()
}
fn hashes(&self) -> &AncestorHashes {
&self.hashes
}
}
impl Rule {