Update CONTRIBUTING.md for rustfix tests

This commit is contained in:
Philipp Hansch 2018-12-09 17:01:51 +01:00
parent 7d9bf99df1
commit 3f978afe8d
No known key found for this signature in database
GPG key ID: B6FA06A6E0E2665B

View file

@ -156,6 +156,15 @@ Therefore you should use `tests/ui/update-all-references.sh` (after running
`cargo test`) and check whether the output looks as you expect with `git diff`. Commit all
`*.stderr` files, too.
If the lint you are working on is making use of structured suggestions, the
test file should include a `// run-rustfix` comment at the top. This will
additionally run [rustfix](https://github.com/rust-lang-nursery/rustfix) for
that test. Rustfix will apply the suggestions from the lint to the code of the
test file and compare that to the contents of a `.fixed` file.
Use `tests/ui/update-all-references.sh` to automatically generate the
`.fixed` file after running `cargo test`.
### Running rustfmt
[Rustfmt](https://github.com/rust-lang/rustfmt) is a tool for formatting Rust code according