style: Avoid unused context argument.

In custom_properties::SpecifiedValue::parse.

It's not a big deal now, but it's useful to simplify testing this stuff, since
it avoids forcing us to mock it.
This commit is contained in:
Emilio Cobos Álvarez 2017-10-08 12:38:25 +02:00
parent 3f4afbafab
commit 8ea275a376
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 13 additions and 12 deletions

View file

@ -8,7 +8,6 @@
use Atom; use Atom;
use cssparser::{Delimiter, Parser, ParserInput, SourcePosition, Token, TokenSerializationType}; use cssparser::{Delimiter, Parser, ParserInput, SourcePosition, Token, TokenSerializationType};
use parser::ParserContext;
use precomputed_hash::PrecomputedHash; use precomputed_hash::PrecomputedHash;
use properties::{CSSWideKeyword, DeclaredValue}; use properties::{CSSWideKeyword, DeclaredValue};
use selector_map::{PrecomputedHashSet, PrecomputedDiagnosticHashMap}; use selector_map::{PrecomputedHashSet, PrecomputedDiagnosticHashMap};
@ -246,15 +245,17 @@ impl ComputedValue {
impl SpecifiedValue { impl SpecifiedValue {
/// Parse a custom property SpecifiedValue. /// Parse a custom property SpecifiedValue.
pub fn parse<'i, 't>( pub fn parse<'i, 't>(
_context: &ParserContext,
input: &mut Parser<'i, 't>, input: &mut Parser<'i, 't>,
) -> Result<Box<Self>, ParseError<'i>> { ) -> Result<Box<Self>, ParseError<'i>> {
let mut references = PrecomputedHashSet::default(); let mut references = PrecomputedHashSet::default();
let (first, css, last) = parse_self_contained_declaration_value(input, Some(&mut references))?;
let (first_token_type, css, last_token_type) =
parse_self_contained_declaration_value(input, Some(&mut references))?;
Ok(Box::new(SpecifiedValue { Ok(Box::new(SpecifiedValue {
css: css.into_owned(), css: css.into_owned(),
first_token_type: first, first_token_type,
last_token_type: last, last_token_type,
references references
})) }))
} }

View file

@ -1635,7 +1635,7 @@ impl PropertyDeclaration {
// This probably affects some test results. // This probably affects some test results.
let value = match input.try(|i| CSSWideKeyword::parse(i)) { let value = match input.try(|i| CSSWideKeyword::parse(i)) {
Ok(keyword) => DeclaredValueOwned::CSSWideKeyword(keyword), Ok(keyword) => DeclaredValueOwned::CSSWideKeyword(keyword),
Err(()) => match ::custom_properties::SpecifiedValue::parse(context, input) { Err(()) => match ::custom_properties::SpecifiedValue::parse(input) {
Ok(value) => DeclaredValueOwned::Value(value), Ok(value) => DeclaredValueOwned::Value(value),
Err(e) => return Err(PropertyDeclarationParseError::InvalidValue(name.to_string().into(), Err(e) => return Err(PropertyDeclarationParseError::InvalidValue(name.to_string().into(),
ValueParseError::from_parse_error(e))), ValueParseError::from_parse_error(e))),

View file

@ -908,18 +908,18 @@ impl Parse for ColorStop {
} }
impl Parse for PaintWorklet { impl Parse for PaintWorklet {
fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> { fn parse<'i, 't>(
_context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
input.expect_function_matching("paint")?; input.expect_function_matching("paint")?;
input.parse_nested_block(|input| { input.parse_nested_block(|input| {
let name = Atom::from(&**input.expect_ident()?); let name = Atom::from(&**input.expect_ident()?);
let arguments = input.try(|input| { let arguments = input.try(|input| {
input.expect_comma()?; input.expect_comma()?;
input.parse_comma_separated(|input| Ok(*SpecifiedValue::parse(context, input)?)) input.parse_comma_separated(|input| Ok(*SpecifiedValue::parse(input)?))
}).unwrap_or(vec![]); }).unwrap_or(vec![]);
Ok(PaintWorklet { Ok(PaintWorklet { name, arguments })
name: name,
arguments: arguments,
})
}) })
} }
} }