You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+20-8
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,16 @@ visit the `#clippy` IRC channel on `irc.mozilla.org`.
9
9
10
10
All contributors are expected to follow the [Rust Code of Conduct](http://www.rust-lang.org/conduct.html).
11
11
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
+
12
22
## Getting started
13
23
14
24
High level approach:
@@ -48,7 +58,7 @@ be more involved and require verifying types. The
48
58
lot of methods that are useful, though one of the most useful would be `expr_ty` (gives the type of
49
59
an AST expression). `match_def_path()` in Clippy's `utils` module can also be useful.
50
60
51
-
###Writing code
61
+
## Writing code
52
62
53
63
Compiling clippy from scratch can take almost a minute or more depending on your machine.
54
64
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
59
69
of this.
60
70
61
71
62
-
####Author lint
72
+
### Author lint
63
73
64
74
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.
65
75
@@ -96,7 +106,7 @@ if_chain! {
96
106
97
107
If the command was executed successfully, you can copy the code over to where you are implementing your lint.
98
108
99
-
####Documentation
109
+
### Documentation
100
110
101
111
Please document your lint with a doc comment akin to the following:
102
112
@@ -122,18 +132,20 @@ Once your lint is merged it will show up in the [lint list](https://rust-lang-nu
122
132
123
133
### Running test suite
124
134
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.
130
136
131
137
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:
132
138
133
139
```bash
134
140
TESTNAME=ui/empty_line_after_outer_attr cargo test --test compile-test
135
141
```
136
142
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
+
137
149
### Testing manually
138
150
139
151
Manually testing against an example file is useful if you have added some
0 commit comments