Skip to content

Commit ecd0a3d

Browse files
author
bors-servo
authored
Auto merge of servo#217 - hcpl:update-syn-quote-proc-macro2, r=SimonSapin
Update `syn`, `quote` and `proc-macro2` <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-cssparser/217) <!-- Reviewable:end -->
2 parents a2abf47 + a8011a5 commit ecd0a3d

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ serde = {version = "1.0", optional = true}
3030
smallvec = "0.6"
3131

3232
[build-dependencies]
33-
syn = { version = "0.12", features = ["extra-traits", "fold"] }
34-
quote = "0.4.1"
35-
proc-macro2 = "0.2"
33+
syn = { version = "0.13", features = ["extra-traits", "fold"] }
34+
quote = "0.5"
35+
proc-macro2 = "0.3"
3636

3737
[features]
3838
bench = []

macros/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cssparser-macros"
3-
version = "0.3.2"
3+
version = "0.3.3"
44
authors = ["Simon Sapin <simon.sapin@exyr.org>"]
55
description = "Procedural macros for cssparser"
66
documentation = "https://docs.rs/cssparser-macros/"
@@ -14,6 +14,6 @@ proc-macro = true
1414
[dependencies]
1515
procedural-masquerade = {path = "../procedural-masquerade", version = "0.1"}
1616
phf_codegen = "0.7"
17-
quote = "0.4"
18-
syn = {version = "0.12", features = ["full", "extra-traits"]}
19-
proc-macro2 = "0.2"
17+
quote = "0.5"
18+
syn = {version = "0.13", features = ["full", "extra-traits"]}
19+
proc-macro2 = "0.3"

macros/lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ extern crate proc_macro2;
1010
extern crate syn;
1111

1212
#[allow(unused_imports)] use std::ascii::AsciiExt;
13-
use quote::ToTokens;
14-
use proc_macro2::{TokenNode, TokenStream, TokenTree};
13+
use std::iter;
14+
use proc_macro2::{TokenStream, TokenTree};
1515

1616
define_proc_macros! {
1717
/// Input: the arms of a `match` expression.
@@ -24,12 +24,12 @@ define_proc_macros! {
2424
pub fn cssparser_internal__assert_ascii_lowercase__max_len(input: &str) -> String {
2525
let expr = syn::parse_str(&format!("match x {{ {} }}", input)).unwrap();
2626
let arms = match expr {
27-
syn::Expr::Match(syn::ExprMatch { ref arms, .. }) => arms,
27+
syn::Expr::Match(syn::ExprMatch { arms, .. }) => arms,
2828
_ => panic!("expected a match expression, got {:?}", expr)
2929
};
30-
max_len(arms.iter().flat_map(|arm| &arm.pats).filter_map(|pattern| {
31-
let expr = match *pattern {
32-
syn::Pat::Lit(ref expr) => expr,
30+
max_len(arms.into_iter().flat_map(|arm| arm.pats).filter_map(|pattern| {
31+
let expr = match pattern {
32+
syn::Pat::Lit(expr) => expr,
3333
syn::Pat::Wild(_) => return None,
3434
_ => panic!("expected string or wildcard pattern, got {:?}", pattern)
3535
};
@@ -93,6 +93,6 @@ fn max_len<I: Iterator<Item=usize>>(lengths: I) -> String {
9393
}
9494

9595
fn string_literal(token: &TokenTree) -> String {
96-
let lit: syn::LitStr = syn::parse2(token.clone().into()).expect(&format!("expected string literal, got {:?}", token));
96+
let lit: syn::LitStr = syn::parse2(iter::once(token.clone()).collect()).expect(&format!("expected string literal, got {:?}", token));
9797
lit.value()
9898
}

0 commit comments

Comments
 (0)