From 47c128d6e9c44b560b5db172ca799d0919c74447 Mon Sep 17 00:00:00 2001 From: Conor Davis Date: Fri, 13 Aug 2021 22:22:07 -0500 Subject: [PATCH] Add `make rustfmt` target. This is intended to be run on occasion to let us take advantage of rustfmt features available only in nightly while not requiring all contributors and CI to use nightly rustfmt. If the output of nightly rustfmt is not accepted by stable rustfmt, then the recipe will intentionally fail. For now, we prefer to detect when the two versions disagree on formatting rather than let nightly and stable rustfmt stomp on each other. --- Makefile | 4 ++++ rustfmt-nightly.toml | 3 +++ 2 files changed, 7 insertions(+) create mode 100644 rustfmt-nightly.toml diff --git a/Makefile b/Makefile index 7b1a466ca5e..7d8d6996885 100644 --- a/Makefile +++ b/Makefile @@ -282,3 +282,7 @@ force-update-assets: ## As update-assets, but will run git to update the baselin check-size: ## Run cargo-diet on all crates to see that they are still in bound ./etc/check-package-size.sh + +rustfmt: ## run nightly rustfmt for its extra features, but check that it won't upset stable rustfmt + cargo +nightly fmt --all -- --config-path rustfmt-nightly.toml + cargo +stable fmt --all -- --check diff --git a/rustfmt-nightly.toml b/rustfmt-nightly.toml new file mode 100644 index 00000000000..1a25d9c9295 --- /dev/null +++ b/rustfmt-nightly.toml @@ -0,0 +1,3 @@ +group_imports = "StdExternalCrate" +imports_granularity = "Crate" +max_width = 120