Skip to content

Commit ad899fe

Browse files
authored
Merge pull request #2697 from phansch/add_contributing_toc
Add TOC to contribution instructions
2 parents 7de3a1d + 6f47cb1 commit ad899fe

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

CONTRIBUTING.md

+20-8
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ visit the `#clippy` IRC channel on `irc.mozilla.org`.
99

1010
All contributors are expected to follow the [Rust Code of Conduct](http://www.rust-lang.org/conduct.html).
1111

12+
* [Getting started](#getting-started)
13+
* [Finding something to fix/improve](#finding-something-to-fiximprove)
14+
* [Writing code](#writing-code)
15+
* [Author lint](#author-lint)
16+
* [Documentation](#documentation)
17+
* [Running test suite](#running-test-suite)
18+
* [Testing manually](#testing-manually)
19+
* [How Clippy works](#how-clippy-works)
20+
* [Contributions](#contributions)
21+
1222
## Getting started
1323

1424
High level approach:
@@ -48,7 +58,7 @@ be more involved and require verifying types. The
4858
lot of methods that are useful, though one of the most useful would be `expr_ty` (gives the type of
4959
an AST expression). `match_def_path()` in Clippy's `utils` module can also be useful.
5060

51-
### Writing code
61+
## Writing code
5262

5363
Compiling clippy from scratch can take almost a minute or more depending on your machine.
5464
However, since Rust 1.24.0 incremental compilation is enabled by default and compile times for small changes should be quick.
@@ -59,7 +69,7 @@ to lint-writing, though it does get into advanced stuff. Most lints consist of a
5969
of this.
6070

6171

62-
#### Author lint
72+
### Author lint
6373

6474
There is also the internal `author` lint to generate clippy code that detects the offending pattern. It does not work for all of the Rust syntax, but can give a good starting point.
6575

@@ -96,7 +106,7 @@ if_chain! {
96106

97107
If the command was executed successfully, you can copy the code over to where you are implementing your lint.
98108

99-
#### Documentation
109+
### Documentation
100110

101111
Please document your lint with a doc comment akin to the following:
102112

@@ -122,18 +132,20 @@ Once your lint is merged it will show up in the [lint list](https://rust-lang-nu
122132

123133
### Running test suite
124134

125-
Clippy uses UI tests. UI tests check that the output of the compiler is exactly as expected.
126-
Of course there's little sense in writing the output yourself or copying it around.
127-
Therefore you can simply run `tests/ui/update-all-references.sh` (after running
128-
`cargo test`) and check whether the output looks as you expect with `git diff`. Commit all
129-
`*.stderr` files, too.
135+
Use `cargo test` to run the whole testsuite.
130136

131137
If you don't want to wait for all tests to finish, you can also execute a single test file by using `TESTNAME` to specify the test to run:
132138

133139
```bash
134140
TESTNAME=ui/empty_line_after_outer_attr cargo test --test compile-test
135141
```
136142

143+
Clippy uses UI tests. UI tests check that the output of the compiler is exactly as expected.
144+
Of course there's little sense in writing the output yourself or copying it around.
145+
Therefore you should use `tests/ui/update-all-references.sh` (after running
146+
`cargo test`) and check whether the output looks as you expect with `git diff`. Commit all
147+
`*.stderr` files, too.
148+
137149
### Testing manually
138150

139151
Manually testing against an example file is useful if you have added some

0 commit comments

Comments
 (0)