From fcbf9836cf63fdfdabae5f7c45eab7980dda43be Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Fri, 18 Oct 2019 18:31:31 +0200 Subject: [PATCH] Update phf to 0.8 --- Cargo.toml | 4 ++-- macros/Cargo.toml | 4 ++-- macros/lib.rs | 4 +--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9f4c20bf..73925b19 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,12 +19,12 @@ difference = "2.0" encoding_rs = "0.8" [dependencies] -cssparser-macros = {path = "./macros", version = "0.3.3"} +cssparser-macros = {path = "./macros", version = "0.4"} dtoa-short = "0.3" heapsize = {version = ">= 0.3, < 0.5", optional = true} itoa = "0.4" matches = "0.1" -phf = "0.7" +phf = "0.8" procedural-masquerade = {path = "./procedural-masquerade", version = "0.1"} serde = {version = "1.0", optional = true} smallvec = "0.6" diff --git a/macros/Cargo.toml b/macros/Cargo.toml index 36b207a6..52ffe584 100644 --- a/macros/Cargo.toml +++ b/macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cssparser-macros" -version = "0.3.6" +version = "0.4.0" authors = ["Simon Sapin "] description = "Procedural macros for cssparser" documentation = "https://docs.rs/cssparser-macros/" @@ -13,7 +13,7 @@ proc-macro = true [dependencies] procedural-masquerade = {path = "../procedural-masquerade", version = "0.1"} -phf_codegen = "0.7" +phf_codegen = "0.8" quote = "1" syn = {version = "1", features = ["full", "extra-traits"]} proc-macro2 = "1" diff --git a/macros/lib.rs b/macros/lib.rs index 31c4ab62..421a12da 100644 --- a/macros/lib.rs +++ b/macros/lib.rs @@ -86,9 +86,7 @@ define_proc_macros! { let mut tokens = quote! { static MAP: ::cssparser::_internal__phf::Map<&'static str, #value_type> = }; - let mut initializer_bytes = Vec::new(); - map.build(&mut initializer_bytes).unwrap(); - tokens.append_all(syn::parse_str::(::std::str::from_utf8(&initializer_bytes).unwrap())); + tokens.append_all(syn::parse_str::(&map.build().to_string())); tokens.append_all(quote!(;)); tokens.to_string() }