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

Commit 4ed1b4b

Browse files
author
bors-servo
committed
Auto merge of #76 - servo:rustup, r=Ms2ger
Upgrade to rustc 1.9.0-nightly (6d215fe04 2016-03-14) Custom hashers are now stable. This raises the minimum Rust version to 1.7 (the current stable). <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-selectors/76) <!-- Reviewable:end -->
2 parents c28f453 + 019ec09 commit 4ed1b4b

File tree

4 files changed

+12
-43
lines changed

4 files changed

+12
-43
lines changed

Cargo.toml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
name = "selectors"
4-
version = "0.5.1"
4+
version = "0.5.2"
55
authors = ["Simon Sapin <[email protected]>", "Alan Jeffrey <[email protected]>"]
66
documentation = "http://doc.servo.org/selectors/"
77

@@ -23,15 +23,8 @@ smallvec = "0.1"
2323
fnv = "1.0"
2424
string_cache = "0.2"
2525
quickersort = "1.0.0"
26-
27-
[dependencies.heapsize]
28-
version = ">=0.1.1, <0.4"
29-
features = [ "unstable" ]
30-
optional = true
31-
32-
[dependencies.heapsize_plugin]
33-
version = "0.1.0"
34-
optional = true
26+
heapsize = {version = ">=0.1.1, <0.4", features = ["unstable"], optional = true}
27+
heapsize_plugin = {version = "0.1.0", optional = true}
3528

3629
[dev-dependencies]
3730
rand = "0.3"

src/lib.rs

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +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 = "unstable", feature(plugin, hashmap_hasher, custom_derive))]
65
#![cfg_attr(all(test, feature = "unstable"), feature(test))]
76
#![cfg_attr(feature = "heap_size", feature(plugin, custom_derive))]
87
#![cfg_attr(feature = "heap_size", plugin(heapsize_plugin))]
@@ -24,27 +23,4 @@ mod tree;
2423

2524
pub use tree::Element;
2625

27-
28-
#[cfg(feature = "unstable")]
29-
mod hash_map {
30-
use std::collections::hash_state::DefaultState;
31-
use std::hash::Hash;
32-
33-
pub type HashMap<K, V> = ::std::collections::HashMap<K, V, DefaultState<::fnv::FnvHasher>>;
34-
35-
pub fn new<K, V>() -> HashMap<K, V> where K: Hash + Eq {
36-
::std::collections::HashMap::with_hash_state(Default::default())
37-
}
38-
}
39-
40-
#[cfg(not(feature = "unstable"))]
41-
mod hash_map {
42-
use std::hash::Hash;
43-
44-
// Default state: Random SipHasher
45-
pub type HashMap<K, V> = ::std::collections::HashMap<K, V>;
46-
47-
pub fn new<K, V>() -> HashMap<K, V> where K: Hash + Eq {
48-
::std::collections::HashMap::new()
49-
}
50-
}
26+
pub type HashMap<K, V> = ::std::collections::HashMap<K, V, ::std::hash::BuildHasherDefault<::fnv::FnvHasher>>;

src/matching.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use string_cache::Atom;
1313
use parser::{CaseSensitivity, Combinator, CompoundSelector, LocalName};
1414
use parser::{SimpleSelector, Selector, SelectorImpl};
1515
use tree::Element;
16-
use hash_map::{self, HashMap};
16+
use HashMap;
1717

1818
/// The definition of whitespace per CSS Selectors Level 3 § 4.
1919
pub static SELECTOR_WHITESPACE: &'static [char] = &[' ', '\t', '\n', '\r', '\x0C'];
@@ -55,10 +55,10 @@ pub struct SelectorMap<T, Impl: SelectorImpl> {
5555
impl<T, Impl: SelectorImpl> SelectorMap<T, Impl> {
5656
pub fn new() -> SelectorMap<T, Impl> {
5757
SelectorMap {
58-
id_hash: hash_map::new(),
59-
class_hash: hash_map::new(),
60-
local_name_hash: hash_map::new(),
61-
lower_local_name_hash: hash_map::new(),
58+
id_hash: HashMap::default(),
59+
class_hash: HashMap::default(),
60+
local_name_hash: HashMap::default(),
61+
lower_local_name_hash: HashMap::default(),
6262
universal_rules: vec!(),
6363
empty: true,
6464
}

src/parser.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use heapsize::HeapSizeOf;
1414
use cssparser::{Token, Parser, parse_nth};
1515
use string_cache::{Atom, Namespace};
1616

17-
use hash_map;
17+
use HashMap;
1818

1919
/// This trait allows to define the parser implementation in regards
2020
/// of pseudo-classes/elements
@@ -50,15 +50,15 @@ pub trait SelectorImpl {
5050
pub struct ParserContext {
5151
pub in_user_agent_stylesheet: bool,
5252
pub default_namespace: Option<Namespace>,
53-
pub namespace_prefixes: hash_map::HashMap<String, Namespace>,
53+
pub namespace_prefixes: HashMap<String, Namespace>,
5454
}
5555

5656
impl ParserContext {
5757
pub fn new() -> ParserContext {
5858
ParserContext {
5959
in_user_agent_stylesheet: false,
6060
default_namespace: None,
61-
namespace_prefixes: hash_map::new(),
61+
namespace_prefixes: HashMap::default(),
6262
}
6363
}
6464
}

0 commit comments

Comments
 (0)