From 0f6f458cc1b460076093efda903bf1a1b9062697 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 8 Mar 2021 16:35:27 +0300 Subject: Make working with codegen less annoying We probably should look into removing `xtask codegen` altogether. The test workflow works perfectly for package.json config. There are two things preventing that: * Lint completions are generated on demand. * Docs are not committed to the repository. --- xtask/src/main.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'xtask/src/main.rs') diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 3c4332f75..25fd32f92 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -89,11 +89,16 @@ fn run_rustfmt(mode: Mode) -> Result<()> { let _dir = pushd(project_root())?; let _e = pushenv("RUSTUP_TOOLCHAIN", "stable"); ensure_rustfmt()?; - let check = match mode { - Mode::Overwrite => &[][..], - Mode::Verify => &["--", "--check"], + match mode { + Mode::Overwrite => cmd!("cargo fmt").run()?, + Mode::Ensure => { + let res = cmd!("cargo fmt -- --check").run(); + if !res.is_ok() { + let _ = cmd!("cargo fmt").run(); + } + res?; + } }; - cmd!("cargo fmt {check...}").run()?; Ok(()) } -- cgit v1.2.3