Skip to content

Commit 14d1e8d

Browse files
committed
Document how to run rustfmt in CONTRIBUTING.md
1 parent 63fa5d2 commit 14d1e8d

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

CONTRIBUTING.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ All contributors are expected to follow the [Rust Code of Conduct](http://www.ru
1717
* [Author lint](#author-lint)
1818
* [Documentation](#documentation)
1919
* [Running test suite](#running-test-suite)
20+
* [Running rustfmt](#running-rustfmt)
2021
* [Testing manually](#testing-manually)
22+
* [Linting Clippy with your local changes](#linting-clippy-with-your-local-changes)
2123
* [How Clippy works](#how-clippy-works)
2224
* [Fixing nightly build failures](#fixing-build-failures-caused-by-rust)
2325
* [Contributions](#contributions)
@@ -145,14 +147,26 @@ Therefore you should use `tests/ui/update-all-references.sh` (after running
145147
`cargo test`) and check whether the output looks as you expect with `git diff`. Commit all
146148
`*.stderr` files, too.
147149

150+
### Running rustfmt
151+
152+
[Rustfmt](https://github.com/rust-lang/rustfmt) is a tool for formatting Rust code according
153+
to style guidelines. The code has to be formatted by `rustfmt` before a PR will be merged.
154+
155+
It can be installed via `rustup`:
156+
```bash
157+
rustup component add rustfmt-preview
158+
```
159+
160+
Use `cargo fmt --all` to format the whole codebase.
161+
148162
### Testing manually
149163

150164
Manually testing against an example file is useful if you have added some
151165
`println!`s and test suite output becomes unreadable. To try Clippy with your
152166
local modifications, run `env CLIPPY_TESTS=true cargo run --bin clippy-driver -- -L ./target/debug input.rs`
153167
from the working copy root.
154168

155-
### Linting Clippy with your changes locally
169+
### Linting Clippy with your local changes
156170

157171
Clippy CI only passes if all lints defined in the version of the Clippy being
158172
tested pass (that is, don’t report any suggestions). You can avoid prolonging
@@ -245,7 +259,8 @@ Contributions to Clippy should be made in the form of GitHub pull requests. Each
245259
be reviewed by a core contributor (someone with permission to land patches) and either landed in the
246260
main tree or given feedback for changes that would be required.
247261

248-
All code in this repository is under the [Mozilla Public License, 2.0](https://www.mozilla.org/MPL/2.0/)
262+
All code in this repository is under the [Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0>)
263+
or the [MIT](http://opensource.org/licenses/MIT) license.
249264

250265
<!-- adapted from https://github.com/servo/servo/blob/master/CONTRIBUTING.md -->
251266

0 commit comments

Comments
 (0)