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.
This commit is contained in:
Aleksey Kladov 2021-03-08 16:35:27 +03:00
parent 071dde1c1d
commit 0f6f458cc1
3 changed files with 25 additions and 21 deletions

View file

@ -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(())
}