From fd394ff424a8abde35f24643dfabbd5bd3f2f43c Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 10 Jan 2020 11:23:11 +0100 Subject: Use correct rustfmt for codegen closes #1569 --- xtask/src/codegen.rs | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) (limited to 'xtask/src/codegen.rs') diff --git a/xtask/src/codegen.rs b/xtask/src/codegen.rs index 158cfc2d6..efa638e06 100644 --- a/xtask/src/codegen.rs +++ b/xtask/src/codegen.rs @@ -9,15 +9,9 @@ mod gen_syntax; mod gen_parser_tests; mod gen_assists_docs; -use std::{ - fs, - io::Write, - mem, - path::Path, - process::{Command, Stdio}, -}; +use std::{fs, mem, path::Path}; -use crate::{project_root, Result}; +use crate::Result; pub use self::{ gen_assists_docs::generate_assists_docs, gen_parser_tests::generate_parser_tests, @@ -62,20 +56,6 @@ fn update(path: &Path, contents: &str, mode: Mode) -> Result<()> { } } -fn reformat(text: impl std::fmt::Display) -> Result { - let mut rustfmt = Command::new("rustfmt") - .arg("--config-path") - .arg(project_root().join("rustfmt.toml")) - .stdin(Stdio::piped()) - .stdout(Stdio::piped()) - .spawn()?; - write!(rustfmt.stdin.take().unwrap(), "{}", text)?; - let output = rustfmt.wait_with_output()?; - let stdout = String::from_utf8(output.stdout)?; - let preamble = "Generated file, do not edit by hand, see `crate/ra_tools/src/codegen`"; - Ok(format!("//! {}\n\n{}", preamble, stdout)) -} - fn extract_comment_blocks(text: &str) -> Vec> { do_extract_comment_blocks(text, false) } -- cgit v1.2.3