aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/style/counter_style/mod.rs18
-rw-r--r--components/style/stylesheets/document_rule.rs10
-rw-r--r--components/style/values/mod.rs9
3 files changed, 17 insertions, 20 deletions
diff --git a/components/style/counter_style/mod.rs b/components/style/counter_style/mod.rs
index 4e195dd15b8..f0fa18fda92 100644
--- a/components/style/counter_style/mod.rs
+++ b/components/style/counter_style/mod.rs
@@ -401,11 +401,10 @@ pub enum Symbol {
impl Parse for Symbol {
fn parse<'i, 't>(_context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
let location = input.current_source_location();
- match input.next() {
- Ok(&Token::QuotedString(ref s)) => Ok(Symbol::String(s.as_ref().to_owned())),
- Ok(&Token::Ident(ref s)) => Ok(Symbol::Ident(s.as_ref().to_owned())),
- Ok(t) => Err(location.new_unexpected_token_error(t.clone())),
- Err(e) => Err(e.into()),
+ match *input.next()? {
+ Token::QuotedString(ref s) => Ok(Symbol::String(s.as_ref().to_owned())),
+ Token::Ident(ref s) => Ok(Symbol::Ident(s.as_ref().to_owned())),
+ ref t => Err(location.new_unexpected_token_error(t.clone())),
}
}
}
@@ -470,11 +469,10 @@ impl Parse for Ranges {
fn parse_bound<'i, 't>(input: &mut Parser<'i, 't>) -> Result<Option<i32>, ParseError<'i>> {
let location = input.current_source_location();
- match input.next() {
- Ok(&Token::Number { int_value: Some(v), .. }) => Ok(Some(v)),
- Ok(&Token::Ident(ref ident)) if ident.eq_ignore_ascii_case("infinite") => Ok(None),
- Ok(t) => Err(location.new_unexpected_token_error(t.clone())),
- Err(e) => Err(e.into()),
+ match *input.next()? {
+ Token::Number { int_value: Some(v), .. } => Ok(Some(v)),
+ Token::Ident(ref ident) if ident.eq_ignore_ascii_case("infinite") => Ok(None),
+ ref t => Err(location.new_unexpected_token_error(t.clone())),
}
}
diff --git a/components/style/stylesheets/document_rule.rs b/components/style/stylesheets/document_rule.rs
index 6227960537c..61c8f2762ef 100644
--- a/components/style/stylesheets/document_rule.rs
+++ b/components/style/stylesheets/document_rule.rs
@@ -101,11 +101,11 @@ macro_rules! parse_quoted_or_unquoted_string {
let start = input.position();
input.parse_entirely(|input| {
let location = input.current_source_location();
- match input.next() {
- Ok(&Token::QuotedString(ref value)) =>
- Ok($url_matching_function(value.as_ref().to_owned())),
- Ok(t) => Err(location.new_unexpected_token_error(t.clone())),
- Err(e) => Err(e.into()),
+ match *input.next()? {
+ Token::QuotedString(ref value) => {
+ Ok($url_matching_function(value.as_ref().to_owned()))
+ },
+ ref t => Err(location.new_unexpected_token_error(t.clone())),
}
}).or_else(|_: ParseError| {
while let Ok(_) = input.next() {}
diff --git a/components/style/values/mod.rs b/components/style/values/mod.rs
index 0aa1ae4ccf3..1507f4fe3e1 100644
--- a/components/style/values/mod.rs
+++ b/components/style/values/mod.rs
@@ -171,11 +171,10 @@ impl hash::Hash for KeyframesName {
impl Parse for KeyframesName {
fn parse<'i, 't>(_context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
let location = input.current_source_location();
- match input.next() {
- Ok(&Token::Ident(ref s)) => Ok(KeyframesName::Ident(CustomIdent::from_ident(location, s, &["none"])?)),
- Ok(&Token::QuotedString(ref s)) => Ok(KeyframesName::QuotedString(Atom::from(s.as_ref()))),
- Ok(t) => Err(location.new_unexpected_token_error(t.clone())),
- Err(e) => Err(e.into()),
+ match *input.next()? {
+ Token::Ident(ref s) => Ok(KeyframesName::Ident(CustomIdent::from_ident(location, s, &["none"])?)),
+ Token::QuotedString(ref s) => Ok(KeyframesName::QuotedString(Atom::from(s.as_ref()))),
+ ref t => Err(location.new_unexpected_token_error(t.clone())),
}
}
}