Skip to content

Commit 83e2109

Browse files
authored
Merge pull request #2606 from phansch/improve_contributing_instructions
Improve CONTRIBUTING.md
2 parents 4ef7238 + 872db02 commit 83e2109

File tree

1 file changed

+23
-24
lines changed

1 file changed

+23
-24
lines changed

CONTRIBUTING.md

+23-24
Original file line numberDiff line numberDiff line change
@@ -15,41 +15,41 @@ High level approach:
1515

1616
All issues on Clippy are mentored, if you want help with a bug just ask @Manishearth, @llogiq, @mcarton or @oli-obk.
1717

18-
Some issues are easier than others. The [good first issue](https://github.com/rust-lang-nursery/rust-clippy/labels/good%20first%20issue)
18+
Some issues are easier than others. The [`good first issue`](https://github.com/rust-lang-nursery/rust-clippy/labels/good%20first%20issue)
1919
label can be used to find the easy issues. If you want to work on an issue, please leave a comment
2020
so that we can assign it to you!
2121

22-
Issues marked [T-AST](https://github.com/rust-lang-nursery/rust-clippy/labels/T-AST) involve simple
22+
Issues marked [`T-AST`](https://github.com/rust-lang-nursery/rust-clippy/labels/T-AST) involve simple
2323
matching of the syntax tree structure, and are generally easier than
24-
[T-middle](https://github.com/rust-lang-nursery/rust-clippy/labels/T-middle) issues, which involve types
24+
[`T-middle`](https://github.com/rust-lang-nursery/rust-clippy/labels/T-middle) issues, which involve types
2525
and resolved paths.
2626

27-
Issues marked [E-medium](https://github.com/rust-lang-nursery/rust-clippy/labels/E-medium) are generally
28-
pretty easy too, though it's recommended you work on an E-easy issue first. They are mostly classified
29-
as `E-medium`, since they might be somewhat involved code wise, but not difficult per-se.
30-
31-
[Llogiq's blog post on lints](https://llogiq.github.io/2015/06/04/workflows.html) is a nice primer
32-
to lint-writing, though it does get into advanced stuff. Most lints consist of an implementation of
33-
`LintPass` with one or more of its default methods overridden. See the existing lints for examples
34-
of this.
35-
36-
T-AST issues will generally need you to match against a predefined syntax structure. To figure out
27+
[`T-AST`](https://github.com/rust-lang-nursery/rust-clippy/labels/T-AST) issues will generally need you to match against a predefined syntax structure. To figure out
3728
how this syntax structure is encoded in the AST, it is recommended to run `rustc -Z ast-json` on an
3829
example of the structure and compare with the
3930
[nodes in the AST docs](http://manishearth.github.io/rust-internals-docs/syntax/ast/). Usually
4031
the lint will end up to be a nested series of matches and ifs,
4132
[like so](https://github.com/rust-lang-nursery/rust-clippy/blob/de5ccdfab68a5e37689f3c950ed1532ba9d652a0/src/misc.rs#L34).
4233

43-
T-middle issues can be more involved and require verifying types. The
34+
[`E-medium`](https://github.com/rust-lang-nursery/rust-clippy/labels/E-medium) issues are generally
35+
pretty easy too, though it's recommended you work on an E-easy issue first. They are mostly classified
36+
as `E-medium`, since they might be somewhat involved code wise, but not difficult per-se.
37+
38+
[`T-middle`](https://github.com/rust-lang-nursery/rust-clippy/labels/T-middle) issues can
39+
be more involved and require verifying types. The
4440
[`ty`](http://manishearth.github.io/rust-internals-docs/rustc/ty) module contains a
4541
lot of methods that are useful, though one of the most useful would be `expr_ty` (gives the type of
4642
an AST expression). `match_def_path()` in Clippy's `utils` module can also be useful.
4743

4844
### Writing code
4945

50-
Compiling clippy can take almost a minute or more depending on your machine.
51-
You can set the environment flag `CARGO_INCREMENTAL=1` to cut down that time to
52-
almost a third on average, depending on the influence your change has.
46+
Compiling clippy from scratch can take almost a minute or more depending on your machine.
47+
However, since Rust 1.24.0 incremental compilation is enabled by default and compile times for small changes should be quick.
48+
49+
[Llogiq's blog post on lints](https://llogiq.github.io/2015/06/04/workflows.html) is a nice primer
50+
to lint-writing, though it does get into advanced stuff. Most lints consist of an implementation of
51+
`LintPass` with one or more of its default methods overridden. See the existing lints for examples
52+
of this.
5353

5454
Please document your lint with a doc comment akin to the following:
5555

@@ -61,8 +61,13 @@ Please document your lint with a doc comment akin to the following:
6161
/// **Known problems:** None. (Or describe where it could go wrong.)
6262
///
6363
/// **Example:**
64+
///
6465
/// ```rust
65-
/// Insert a short example if you have one.
66+
/// // Bad
67+
/// Insert a short example of code that triggers the lint
68+
///
69+
/// // Good
70+
/// Insert a short example of improved code that doesn't trigger the lint
6671
/// ```
6772
```
6873

@@ -80,12 +85,6 @@ If you don't want to wait for all tests to finish, you can also execute a single
8085
TESTNAME=ui/empty_line_after_outer_attr cargo test --test compile-test
8186
```
8287

83-
And you can also combine this with `CARGO_INCREMENTAL`:
84-
85-
```bash
86-
CARGO_INCREMENTAL=1 TESTNAME=ui/doc cargo test --test compile-test
87-
```
88-
8988
### Testing manually
9089

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

0 commit comments

Comments
 (0)