Borrow input to match_ignore_ascii_case!

In cssparser version 0.11, this macro will stop implicitly borrowing its
own input.
This commit is contained in:
Simon Sapin 2017-02-26 10:40:09 +01:00
parent 4fa3e8e82c
commit 0f2d000a23
21 changed files with 62 additions and 61 deletions

View file

@ -20,8 +20,8 @@ macro_rules! define_cursor {
impl Cursor {
/// Given a CSS keyword, get the corresponding cursor enum.
pub fn from_css_keyword(keyword: &str) -> Result<Cursor, ()> {
match_ignore_ascii_case! { keyword,
$( concat!($css) => Ok(Cursor::$variant), )+
match_ignore_ascii_case! { &keyword,
$( $css => Ok(Cursor::$variant), )+
_ => Err(())
}
}

View file

@ -116,7 +116,8 @@ macro_rules! __define_css_keyword_enum__actual {
impl $name {
/// Parse this property from a CSS input stream.
pub fn parse(input: &mut ::cssparser::Parser) -> Result<$name, ()> {
match_ignore_ascii_case! { try!(input.expect_ident()),
let ident = input.expect_ident()?;
match_ignore_ascii_case! { &ident,
$( $css => Ok($name::$variant), )+
_ => Err(())
}