diff --git a/Cargo.toml b/Cargo.toml index cbd5593b..cc444f38 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cssparser" -version = "0.23.3" +version = "0.23.4" authors = [ "Simon Sapin " ] description = "Rust implementation of CSS Syntax Level 3" @@ -30,9 +30,9 @@ serde = {version = "1.0", optional = true} smallvec = "0.6" [build-dependencies] -syn = { version = "0.12", features = ["extra-traits", "fold"] } -quote = "0.4.1" -proc-macro2 = "0.2" +syn = { version = "0.13", features = ["extra-traits", "fold"] } +quote = "0.5" +proc-macro2 = "0.3" [features] bench = [] diff --git a/macros/Cargo.toml b/macros/Cargo.toml index e1da5014..dcd41084 100644 --- a/macros/Cargo.toml +++ b/macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cssparser-macros" -version = "0.3.2" +version = "0.3.3" authors = ["Simon Sapin "] description = "Procedural macros for cssparser" documentation = "https://docs.rs/cssparser-macros/" @@ -14,6 +14,6 @@ proc-macro = true [dependencies] procedural-masquerade = {path = "../procedural-masquerade", version = "0.1"} phf_codegen = "0.7" -quote = "0.4" -syn = {version = "0.12", features = ["full", "extra-traits"]} -proc-macro2 = "0.2" +quote = "0.5" +syn = {version = "0.13", features = ["full", "extra-traits"]} +proc-macro2 = "0.3" diff --git a/macros/lib.rs b/macros/lib.rs index 253616dd..6e4c577d 100644 --- a/macros/lib.rs +++ b/macros/lib.rs @@ -10,8 +10,8 @@ extern crate proc_macro2; extern crate syn; #[allow(unused_imports)] use std::ascii::AsciiExt; -use quote::ToTokens; -use proc_macro2::{TokenNode, TokenStream, TokenTree}; +use std::iter; +use proc_macro2::{TokenStream, TokenTree}; define_proc_macros! { /// Input: the arms of a `match` expression. @@ -24,12 +24,12 @@ define_proc_macros! { pub fn cssparser_internal__assert_ascii_lowercase__max_len(input: &str) -> String { let expr = syn::parse_str(&format!("match x {{ {} }}", input)).unwrap(); let arms = match expr { - syn::Expr::Match(syn::ExprMatch { ref arms, .. }) => arms, + syn::Expr::Match(syn::ExprMatch { arms, .. }) => arms, _ => panic!("expected a match expression, got {:?}", expr) }; - max_len(arms.iter().flat_map(|arm| &arm.pats).filter_map(|pattern| { - let expr = match *pattern { - syn::Pat::Lit(ref expr) => expr, + max_len(arms.into_iter().flat_map(|arm| arm.pats).filter_map(|pattern| { + let expr = match pattern { + syn::Pat::Lit(expr) => expr, syn::Pat::Wild(_) => return None, _ => panic!("expected string or wildcard pattern, got {:?}", pattern) }; @@ -93,6 +93,6 @@ fn max_len>(lengths: I) -> String { } fn string_literal(token: &TokenTree) -> String { - let lit: syn::LitStr = syn::parse2(token.clone().into()).expect(&format!("expected string literal, got {:?}", token)); + let lit: syn::LitStr = syn::parse2(iter::once(token.clone()).collect()).expect(&format!("expected string literal, got {:?}", token)); lit.value() }