From 8adb2346e1a6878ee3a5e8fbe4d960f3396a45d0 Mon Sep 17 00:00:00 2001 From: "Federico G. Schwindt" Date: Wed, 16 Feb 2022 01:54:27 +0000 Subject: [PATCH] Fix phf_codegen example --- README.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index f01286d3..64a24b61 100644 --- a/README.md +++ b/README.md @@ -85,15 +85,18 @@ fn main() { let path = Path::new(&env::var("OUT_DIR").unwrap()).join("codegen.rs"); let mut file = BufWriter::new(File::create(&path).unwrap()); - write!(&mut file, "static KEYWORDS: phf::Map<&'static str, Keyword> = ").unwrap(); - phf_codegen::Map::new() - .entry("loop", "Keyword::Loop") - .entry("continue", "Keyword::Continue") - .entry("break", "Keyword::Break") - .entry("fn", "Keyword::Fn") - .entry("extern", "Keyword::Extern") - .build(&mut file) - .unwrap(); + write!( + &mut file, + "static KEYWORDS: phf::Map<&'static str, Keyword> = {}", + phf_codegen::Map::new() + .entry("loop", "Keyword::Loop") + .entry("continue", "Keyword::Continue") + .entry("break", "Keyword::Break") + .entry("fn", "Keyword::Fn") + .entry("extern", "Keyword::Extern") + .build() + ) + .unwrap(); write!(&mut file, ";\n").unwrap(); } ```