From 1aeb61b727d6dbfe09cac23a5ca502b9127268cd Mon Sep 17 00:00:00 2001 From: Jonathan Li <30177086+MonliH@users.noreply.github.com> Date: Sat, 10 Oct 2020 11:54:45 -0400 Subject: [PATCH 1/4] Document RUSTFMT env var --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index e34b95e1613..ae192958493 100644 --- a/README.md +++ b/README.md @@ -306,6 +306,9 @@ notes above on running rustfmt. | checkstyle | emits in a checkstyle format | Yes | | json | emits diffs in a json format | Yes | +* You can specify the path to your own `rustfmt` by setting the `RUSTFMT` + environment variable. + ## License Rustfmt is distributed under the terms of both the MIT license and the From 428f7f70118cc42a3eaf4ca4b9e3be828d12b872 Mon Sep 17 00:00:00 2001 From: Jonathan Li <30177086+MonliH@users.noreply.github.com> Date: Sun, 11 Oct 2020 07:45:25 -0400 Subject: [PATCH 2/4] Move documentation up --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ae192958493..768a16d3af0 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,9 @@ The easiest way to run rustfmt against a project is with `cargo fmt`. `cargo fmt single-crate projects and [cargo workspaces](https://doc.rust-lang.org/book/ch14-03-cargo-workspaces.html). Please see `cargo fmt --help` for usage information. +You can specify the path to your own `rustfmt` binary for cargo to use by setting the`RUSTFMT` +environment variable. + ### Running `rustfmt` directly To format individual files or arbitrary codes from stdin, the `rustfmt` binary should be used. Some @@ -265,7 +268,6 @@ notes above on running rustfmt. * For things you do not want rustfmt to mangle, use `#[rustfmt::skip]` * To prevent rustfmt from formatting a macro or an attribute, - use `#[rustfmt::skip::macros(target_macro_name)]` or `#[rustfmt::skip::attributes(target_attribute_name)]` Example: @@ -306,9 +308,6 @@ notes above on running rustfmt. | checkstyle | emits in a checkstyle format | Yes | | json | emits diffs in a json format | Yes | -* You can specify the path to your own `rustfmt` by setting the `RUSTFMT` - environment variable. - ## License Rustfmt is distributed under the terms of both the MIT license and the From 66b7fcf14898404abe8aae7dd5beb04a49ca110d Mon Sep 17 00:00:00 2001 From: Jonathan <30177086+MonliH@users.noreply.github.com> Date: Sun, 11 Oct 2020 15:14:34 +0000 Subject: [PATCH 3/4] Apply suggestions from code review Co-authored-by: Caleb Cartwright --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 768a16d3af0..8a8c5e0841b 100644 --- a/README.md +++ b/README.md @@ -107,7 +107,7 @@ single-crate projects and [cargo workspaces](https://doc.rust-lang.org/book/ch14 Please see `cargo fmt --help` for usage information. You can specify the path to your own `rustfmt` binary for cargo to use by setting the`RUSTFMT` -environment variable. +environment variable. This was added in v1.4.22, so you must have this version or newer to leverage this feature (`cargo fmt --version`) ### Running `rustfmt` directly From 91aa1d31d14a678cc0cd3148bece19745fd2d004 Mon Sep 17 00:00:00 2001 From: Jonathan Li <30177086+MonliH@users.noreply.github.com> Date: Sun, 11 Oct 2020 11:16:51 -0400 Subject: [PATCH 4/4] Fix accedental removal --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 768a16d3af0..927e7805e3b 100644 --- a/README.md +++ b/README.md @@ -268,6 +268,7 @@ notes above on running rustfmt. * For things you do not want rustfmt to mangle, use `#[rustfmt::skip]` * To prevent rustfmt from formatting a macro or an attribute, + use `#[rustfmt::skip::macros(target_macro_name)]` or `#[rustfmt::skip::attributes(target_attribute_name)]` Example: