about summary refs log tree commit diff
path: root/xtask/src/codegen.rs
diff options
context:
space:
mode:
authorAleksey Kladov <aleksey.kladov@gmail.com>2020-01-10 11:23:11 +0100
committerAleksey Kladov <aleksey.kladov@gmail.com>2020-01-10 11:23:43 +0100
commitfd394ff424a8abde35f24643dfabbd5bd3f2f43c (patch)
tree23071b83610a2d0b61ffcb606f83c3e95a2809bd /xtask/src/codegen.rs
parentb77a7e29a5b345a5dcdf427a0b332630147bcd5b (diff)
downloadrust-fd394ff424a8abde35f24643dfabbd5bd3f2f43c.tar.gz
rust-fd394ff424a8abde35f24643dfabbd5bd3f2f43c.zip
Use correct rustfmt for codegen
closes #1569
Diffstat (limited to 'xtask/src/codegen.rs')
-rw-r--r--xtask/src/codegen.rs24
1 files changed, 2 insertions, 22 deletions
diff --git a/xtask/src/codegen.rs b/xtask/src/codegen.rs
index 158cfc2d680..efa638e0603 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<String> {
-    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<Vec<String>> {
     do_extract_comment_blocks(text, false)
 }