From 68df079c0ebf1cffa8cf55afd798e8b70028ba50 Mon Sep 17 00:00:00 2001 From: cyqsimon <28627918+cyqsimon@users.noreply.github.com> Date: Wed, 9 Jul 2025 11:08:24 +0800 Subject: [PATCH] Add improvement note on `parse` + `unparse` --- build/syntax_mapping.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build/syntax_mapping.rs b/build/syntax_mapping.rs index 1636443a..64be4bb9 100644 --- a/build/syntax_mapping.rs +++ b/build/syntax_mapping.rs @@ -288,6 +288,9 @@ pub fn build_static_mappings() -> anyhow::Result<()> { println!("cargo:rerun-if-changed=src/syntax_mapping/builtins/"); let mappings = read_all_mappings()?; + + // IMPRV: parse + unparse is a bit cringe, but there seems to be no better + // option given the limited APIs of `prettyplease` let rs_src = syn::parse_file(&mappings.to_token_stream().to_string())?; let rs_src_pretty = prettyplease::unparse(&rs_src);