Restore cargo-fmt gating

This commit is contained in:
Aleksey Kladov 2020-03-13 12:28:13 +01:00
parent 1e19847af3
commit 680182d0a0
4 changed files with 12 additions and 19 deletions

View file

@ -38,13 +38,11 @@ pub fn project_root() -> PathBuf {
}
pub fn run_rustfmt(mode: Mode) -> Result<()> {
let _dir = pushd(project_root());
ensure_rustfmt()?;
if mode == Mode::Verify {
run!("rustup run {} -- cargo fmt -- --check", TOOLCHAIN)?;
} else {
run!("rustup run {} -- cargo fmt", TOOLCHAIN)?;
}
let check = if mode == Mode::Verify { "--check" } else { "" };
run!("rustup run {} -- cargo fmt -- {}", TOOLCHAIN, check)?;
Ok(())
}