From b82d967182d29f1302187fa0e3a56661d0c4082a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 17 Aug 2020 15:49:46 +0200 Subject: Mention that generated .adocs are generaterd --- xtask/src/codegen.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'xtask/src/codegen.rs') diff --git a/xtask/src/codegen.rs b/xtask/src/codegen.rs index 78a84f68d..98acd7fa6 100644 --- a/xtask/src/codegen.rs +++ b/xtask/src/codegen.rs @@ -15,7 +15,11 @@ use std::{ path::{Path, PathBuf}, }; -use crate::{not_bash::fs2, project_root, Result}; +use crate::{ + ensure_rustfmt, + not_bash::{fs2, pushenv, run}, + project_root, Result, +}; pub use self::{ gen_assists_docs::{generate_assists_docs, generate_assists_tests}, @@ -62,6 +66,18 @@ fn update(path: &Path, contents: &str, mode: Mode) -> Result<()> { } } +const PREAMBLE: &str = "Generated file, do not edit by hand, see `xtask/src/codegen`"; + +fn reformat(text: impl std::fmt::Display) -> Result { + let _e = pushenv("RUSTUP_TOOLCHAIN", "stable"); + ensure_rustfmt()?; + let stdout = run!( + "rustfmt --config-path {} --config fn_single_line=true", project_root().join("rustfmt.toml").display(); + Vec> { do_extract_comment_blocks(text, false).into_iter().map(|(_line, block)| block).collect() } -- cgit v1.2.3