mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Rust upgrade to rustc hash b03a2755193cd756583bcf5831cf4545d75ecb8a
This commit is contained in:
parent
26045d7fcb
commit
d1b433a3b3
160 changed files with 1427 additions and 1162 deletions
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use std::{cmp, iter};
|
||||
use std::ascii::{StrAsciiExt, OwnedStrAsciiExt};
|
||||
use std::ascii::{AsciiExt, OwnedAsciiExt};
|
||||
use sync::Arc;
|
||||
|
||||
use cssparser::ast::*;
|
||||
|
@ -14,14 +14,6 @@ use string_cache::{Atom, Namespace};
|
|||
use namespaces::NamespaceMap;
|
||||
|
||||
|
||||
// Only used in tests
|
||||
impl PartialEq for Arc<CompoundSelector> {
|
||||
fn eq(&self, other: &Arc<CompoundSelector>) -> bool {
|
||||
**self == **other
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[deriving(PartialEq, Clone)]
|
||||
pub struct Selector {
|
||||
pub compound_selectors: Arc<CompoundSelector>,
|
||||
|
@ -328,7 +320,7 @@ fn parse_one_simple_selector<I: Iterator<ComponentValue>>(
|
|||
Some(&IDHash(_)) => match iter.next() {
|
||||
Some(IDHash(id)) => Ok(Some(SimpleSelectorResult(
|
||||
IDSelector(Atom::from_slice(id.as_slice()))))),
|
||||
_ => fail!("Implementation error, this should not happen."),
|
||||
_ => panic!("Implementation error, this should not happen."),
|
||||
},
|
||||
Some(&Delim('.')) => {
|
||||
iter.next();
|
||||
|
@ -341,7 +333,7 @@ fn parse_one_simple_selector<I: Iterator<ComponentValue>>(
|
|||
Some(&SquareBracketBlock(_)) => match iter.next() {
|
||||
Some(SquareBracketBlock(content))
|
||||
=> Ok(Some(SimpleSelectorResult(try!(parse_attribute_selector(content, namespaces))))),
|
||||
_ => fail!("Implementation error, this should not happen."),
|
||||
_ => panic!("Implementation error, this should not happen."),
|
||||
},
|
||||
Some(&Colon) => {
|
||||
iter.next();
|
||||
|
@ -413,7 +405,7 @@ fn parse_qualified_name<I: Iterator<ComponentValue>>(
|
|||
let value = get_next_ident(iter);
|
||||
match iter.peek() {
|
||||
Some(&Delim('|')) => {
|
||||
let namespace = match namespaces.prefix_map.find(&value) {
|
||||
let namespace = match namespaces.prefix_map.get(&value) {
|
||||
None => return Err(()), // Undeclared namespace prefix
|
||||
Some(ref ns) => (*ns).clone(),
|
||||
};
|
||||
|
@ -445,7 +437,7 @@ fn parse_attribute_selector(content: Vec<ComponentValue>, namespaces: &Namespace
|
|||
let iter = &mut content.into_iter().peekable();
|
||||
let attr = match try!(parse_qualified_name(iter, /* in_attr_selector = */ true, namespaces)) {
|
||||
None => return Err(()),
|
||||
Some((_, None)) => fail!("Implementation error, this should not happen."),
|
||||
Some((_, None)) => panic!("Implementation error, this should not happen."),
|
||||
Some((namespace, Some(local_name))) => AttrSelector {
|
||||
namespace: namespace,
|
||||
lower_name: Atom::from_slice(local_name.as_slice().to_ascii_lower().as_slice()),
|
||||
|
@ -578,7 +570,7 @@ fn parse_negation(arguments: Vec<ComponentValue>, namespaces: &NamespaceMap)
|
|||
fn get_next_ident<I: Iterator<ComponentValue>>(iter: &mut Iter<I>) -> String {
|
||||
match iter.next() {
|
||||
Some(Ident(value)) => value,
|
||||
_ => fail!("Implementation error, this should not happen."),
|
||||
_ => panic!("Implementation error, this should not happen."),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue