Commit 81c90578 authored by Emilio Cobos Álvarez's avatar Emilio Cobos Álvarez
Browse files

Bug 1587468 - Update cssparser-macros to 0.3.6. r=boris

Differential Revision: https://phabricator.services.mozilla.com/D48728

--HG--
extra : moz-landing-system : lando
parent 94eeb16e
......@@ -705,7 +705,7 @@ version = "0.25.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser-macros 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser-macros 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"dtoa-short 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"itoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
......@@ -719,14 +719,14 @@ dependencies = [
[[package]]
name = "cssparser-macros"
version = "0.3.5"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"phf_codegen 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"procedural-masquerade 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
......@@ -3866,7 +3866,7 @@ dependencies = [
"checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b"
"checksum crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f8306fcef4a7b563b76b7dd949ca48f52bc1141aa067d2ea09565f3e2652aa5c"
"checksum cssparser 0.25.9 (registry+https://github.com/rust-lang/crates.io-index)" = "fbe18ca4efb9ba3716c6da66cc3d7e673bf59fa576353011f48c4cfddbdd740e"
"checksum cssparser-macros 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b16e382d9b983fdb9ac6a36b37fdeb84ce3ea81f749febfee3463cfa7f24275e"
"checksum cssparser-macros 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "5bb1c84e87c717666564ec056105052331431803d606bd45529b28547b611eef"
"checksum cstr 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b6557bdb1dc9647eae1cf7f5601b14cd45fc3c7ccf2df618387416fe542da6ea"
"checksum cstr-macros 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0f12dd847ec773fc98d75edba5394cb87d0f35e7ee548a4c81849ca6374b3d48"
"checksum cubeb 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "50f6a746cc3a80bdc96203e617d3bfc8988169c012c85c4ca4f1bad7862441bc"
......
{"files":{"Cargo.toml":"865ab5a711a4fea88adf215f7c0207f1ad2ee80c310229f6d2a5770d2ff36486","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","lib.rs":"66c99e9dd05190f31f59ccfd3f9558540f94a501e88849bcaf09191f9f3323da"},"package":"b16e382d9b983fdb9ac6a36b37fdeb84ce3ea81f749febfee3463cfa7f24275e"}
\ No newline at end of file
{"files":{"Cargo.toml":"2933f8de8e313cbee4a5643b10242657dc6e7d06baac22d2c17b390b6c844419","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","lib.rs":"d3f200eeedd4e0dfe88562449368b01d07754fed677359e1e92d3293e1c8d8c6"},"package":"5bb1c84e87c717666564ec056105052331431803d606bd45529b28547b611eef"}
\ No newline at end of file
......@@ -3,7 +3,7 @@
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
# to registry (e.g. crates.io) dependencies
# to registry (e.g., crates.io) dependencies
#
# If you believe there's an error in this file please file an
# issue against the rust-lang/cargo repository. If you're
......@@ -12,7 +12,7 @@
[package]
name = "cssparser-macros"
version = "0.3.5"
version = "0.3.6"
authors = ["Simon Sapin <simon.sapin@exyr.org>"]
description = "Procedural macros for cssparser"
documentation = "https://docs.rs/cssparser-macros/"
......@@ -26,14 +26,14 @@ proc-macro = true
version = "0.7"
[dependencies.proc-macro2]
version = "0.4"
version = "1"
[dependencies.procedural-masquerade]
version = "0.1"
[dependencies.quote]
version = "0.6"
version = "1"
[dependencies.syn]
version = "0.15.12"
version = "1"
features = ["full", "extra-traits"]
......@@ -2,17 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#[macro_use] extern crate procedural_masquerade;
#[macro_use]
extern crate procedural_masquerade;
extern crate phf_codegen;
extern crate proc_macro;
extern crate proc_macro2;
#[macro_use] extern crate quote;
#[macro_use]
extern crate quote;
extern crate syn;
#[allow(unused_imports)] use std::ascii::AsciiExt;
use proc_macro2::{TokenStream, TokenTree};
use quote::TokenStreamExt;
use std::iter;
use proc_macro2::{TokenStream, TokenTree};
define_proc_macros! {
/// Input: the arms of a `match` expression.
......@@ -28,7 +29,12 @@ define_proc_macros! {
syn::Expr::Match(syn::ExprMatch { arms, .. }) => arms,
_ => panic!("expected a match expression, got {:?}", expr)
};
max_len(arms.into_iter().flat_map(|arm| arm.pats).filter_map(|pattern| {
max_len(arms.into_iter().flat_map(|ref arm| {
match arm.pat {
syn::Pat::Or(ref p) => p.cases.iter().cloned().collect(),
ref p => vec![p.clone()]
}
}).filter_map(|pattern| {
let expr = match pattern {
syn::Pat::Lit(expr) => expr,
syn::Pat::Wild(_) => return None,
......@@ -88,12 +94,13 @@ define_proc_macros! {
}
}
fn max_len<I: Iterator<Item=usize>>(lengths: I) -> String {
fn max_len<I: Iterator<Item = usize>>(lengths: I) -> String {
let max_length = lengths.max().expect("expected at least one string");
quote!( const MAX_LENGTH: usize = #max_length; ).to_string()
}
fn string_literal(token: &TokenTree) -> String {
let lit: syn::LitStr = syn::parse2(iter::once(token.clone()).collect()).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()
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment