Skip to content
This repository was archived by the owner on May 28, 2024. It is now read-only.

Commit 71538fb

Browse files
author
bors-servo
authored
Auto merge of #105 - servo:drive-by-breakage, r=emilio
Drive-by breaking changes Since we’re making a semver-incompatible version anyway (#104) here are a couple other breaking changes. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-selectors/105) <!-- Reviewable:end -->
2 parents 055a8cc + 7c2387c commit 71538fb

File tree

5 files changed

+6
-35
lines changed

5 files changed

+6
-35
lines changed

Cargo.toml

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
name = "selectors"
4-
version = "0.16.0"
4+
version = "0.17.0"
55
authors = ["Simon Sapin <simon.sapin@exyr.org>", "Alan Jeffrey <ajeffrey@mozilla.com>"]
66
documentation = "https://docs.rs/selectors/"
77

@@ -11,13 +11,8 @@ readme = "README.md"
1111
keywords = ["css", "selectors"]
1212
license = "MPL-2.0"
1313

14-
[features]
15-
heap_size = ["heapsize", "heapsize_plugin"]
16-
1714
[dependencies]
1815
bitflags = "0.7"
1916
matches = "0.1"
2017
cssparser = ">=0.6, <0.8"
2118
fnv = "1.0"
22-
heapsize = {version = "0.3", features = ["unstable"], optional = true}
23-
heapsize_plugin = {version = "0.1.0", optional = true}

src/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

5-
#![cfg_attr(feature = "heap_size", feature(plugin, custom_derive))]
6-
#![cfg_attr(feature = "heap_size", plugin(heapsize_plugin))]
7-
8-
#[cfg(feature = "heap_size")] extern crate heapsize;
95
#[macro_use] extern crate bitflags;
106
#[macro_use] extern crate cssparser;
117
#[macro_use] extern crate matches;

src/matching.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ fn matches_simple_selector<E>(
426426
false
427427
}
428428
SimpleSelector::NonTSPseudoClass(ref pc) => {
429-
relation_if!(element.match_non_ts_pseudo_class(pc.clone()),
429+
relation_if!(element.match_non_ts_pseudo_class(pc),
430430
AFFECTED_BY_STATE)
431431
}
432432
SimpleSelector::FirstChild => {

src/parser.rs

+3-23
Original file line numberDiff line numberDiff line change
@@ -83,21 +83,11 @@ macro_rules! with_bounds {
8383
}
8484
}
8585

86-
macro_rules! with_heap_size_bound {
87-
($( $HeapSizeOf: tt )*) => {
88-
with_bounds! {
89-
[Clone + Eq + Hash $($HeapSizeOf)*]
90-
[From<String> + for<'a> From<&'a str>]
91-
}
92-
}
86+
with_bounds! {
87+
[Clone + Eq + Hash]
88+
[From<String> + for<'a> From<&'a str>]
9389
}
9490

95-
#[cfg(feature = "heap_size")]
96-
with_heap_size_bound!(+ ::heapsize::HeapSizeOf);
97-
98-
#[cfg(not(feature = "heap_size"))]
99-
with_heap_size_bound!();
100-
10191
pub trait Parser {
10292
type Impl: SelectorImpl;
10393

@@ -130,7 +120,6 @@ pub trait Parser {
130120
}
131121
}
132122

133-
#[cfg_attr(feature = "heap_size", derive(HeapSizeOf))]
134123
#[derive(PartialEq, Clone, Debug)]
135124
pub struct SelectorList<Impl: SelectorImpl>(pub Vec<Selector<Impl>>);
136125

@@ -146,7 +135,6 @@ impl<Impl: SelectorImpl> SelectorList<Impl> {
146135
}
147136
}
148137

149-
#[cfg_attr(feature = "heap_size", derive(HeapSizeOf))]
150138
#[derive(PartialEq, Clone)]
151139
pub struct Selector<Impl: SelectorImpl> {
152140
pub complex_selector: Arc<ComplexSelector<Impl>>,
@@ -234,14 +222,12 @@ impl<Impl: SelectorImpl> ComplexSelector<Impl> {
234222
}
235223
}
236224

237-
#[cfg_attr(feature = "heap_size", derive(HeapSizeOf))]
238225
#[derive(Clone, Eq, Hash, PartialEq)]
239226
pub struct ComplexSelector<Impl: SelectorImpl> {
240227
pub compound_selector: Vec<SimpleSelector<Impl>>,
241228
pub next: Option<(Arc<ComplexSelector<Impl>>, Combinator)>, // c.next is left of c
242229
}
243230

244-
#[cfg_attr(feature = "heap_size", derive(HeapSizeOf))]
245231
#[derive(Eq, PartialEq, Clone, Copy, Debug, Hash)]
246232
pub enum Combinator {
247233
Child, // >
@@ -250,7 +236,6 @@ pub enum Combinator {
250236
LaterSibling, // ~
251237
}
252238

253-
#[cfg_attr(feature = "heap_size", derive(HeapSizeOf))]
254239
#[derive(Eq, PartialEq, Clone, Hash)]
255240
pub enum SimpleSelector<Impl: SelectorImpl> {
256241
ID(Impl::Identifier),
@@ -289,38 +274,33 @@ pub enum SimpleSelector<Impl: SelectorImpl> {
289274
}
290275

291276
#[derive(Eq, PartialEq, Clone, Hash, Copy, Debug)]
292-
#[cfg_attr(feature = "heap_size", derive(HeapSizeOf))]
293277
pub enum CaseSensitivity {
294278
CaseSensitive, // Selectors spec says language-defined, but HTML says sensitive.
295279
CaseInsensitive,
296280
}
297281

298282

299283
#[derive(Eq, PartialEq, Clone, Hash)]
300-
#[cfg_attr(feature = "heap_size", derive(HeapSizeOf))]
301284
pub struct LocalName<Impl: SelectorImpl> {
302285
pub name: Impl::LocalName,
303286
pub lower_name: Impl::LocalName,
304287
}
305288

306289
#[derive(Eq, PartialEq, Clone, Hash)]
307-
#[cfg_attr(feature = "heap_size", derive(HeapSizeOf))]
308290
pub struct AttrSelector<Impl: SelectorImpl> {
309291
pub name: Impl::LocalName,
310292
pub lower_name: Impl::LocalName,
311293
pub namespace: NamespaceConstraint<Impl>,
312294
}
313295

314296
#[derive(Eq, PartialEq, Clone, Hash, Debug)]
315-
#[cfg_attr(feature = "heap_size", derive(HeapSizeOf))]
316297
pub enum NamespaceConstraint<Impl: SelectorImpl> {
317298
Any,
318299
Specific(Namespace<Impl>),
319300
}
320301

321302
/// FIXME(SimonSapin): should Hash only hash the URL? What is it used for?
322303
#[derive(Eq, PartialEq, Clone, Hash)]
323-
#[cfg_attr(feature = "heap_size", derive(HeapSizeOf))]
324304
pub struct Namespace<Impl: SelectorImpl> {
325305
pub prefix: Option<Impl::NamespacePrefix>,
326306
pub url: Impl::NamespaceUrl,

src/tree.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ pub trait Element: MatchAttr + Sized {
140140
fn get_local_name(&self) -> &<Self::Impl as SelectorImpl>::BorrowedLocalName;
141141
fn get_namespace(&self) -> &<Self::Impl as SelectorImpl>::BorrowedNamespaceUrl;
142142

143-
fn match_non_ts_pseudo_class(&self, pc: <Self::Impl as SelectorImpl>::NonTSPseudoClass) -> bool;
143+
fn match_non_ts_pseudo_class(&self, pc: &<Self::Impl as SelectorImpl>::NonTSPseudoClass) -> bool;
144144

145145
fn get_id(&self) -> Option<<Self::Impl as SelectorImpl>::Identifier>;
146146
fn has_class(&self, name: &<Self::Impl as SelectorImpl>::ClassName) -> bool;

0 commit comments

Comments
 (0)