-# Contributing to rust-clippy
+# Contributing to Clippy
Hello fellow Rustacean! Great to see your interest in compiler internals and lints!
Clippy welcomes contributions from everyone. There are many ways to contribute to Clippy and the following document explains how
you can contribute and how to get started.
If you have any questions about contributing or need help with anything, feel free to ask questions on issues or
-visit the `#clippy` IRC channel on `irc.mozilla.org`.
+visit the `#clippy` IRC channel on `irc.mozilla.org` or meet us in `#wg-clippy` on [Discord](https://discord.gg/rust-lang).
All contributors are expected to follow the [Rust Code of Conduct](http://www.rust-lang.org/conduct.html).
## Writing code
-Compiling clippy from scratch can take almost a minute or more depending on your machine.
+Compiling Clippy from scratch can take almost a minute or more depending on your machine.
However, since Rust 1.24.0 incremental compilation is enabled by default and compile times for small changes should be quick.
[Llogiq's blog post on lints](https://llogiq.github.io/2015/06/04/workflows.html) is a nice primer
### Author lint
-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.
+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.
First, create a new UI test file in the `tests/ui/` directory with the pattern you want to match:
// ./tests/ui/my_lint.stdout
if_chain! {
- if let Expr_::ExprArray(ref elements) = stmt.node;
+ if let ExprKind::Array(ref elements) = stmt.node;
if elements.len() == 1;
- if let Expr_::ExprLit(ref lit) = elements[0].node;
+ if let ExprKind::Lit(ref lit) = elements[0].node;
if let LitKind::Int(7, _) = lit.node;
then {
// report your lint here
### Testing manually
Manually testing against an example file is useful if you have added some
-`println!`s and test suite output becomes unreadable. To try clippy with your
+`println!`s and test suite output becomes unreadable. To try Clippy with your
local modifications, run `cargo run --bin clippy-driver -- -L ./target/debug input.rs` from the
working copy root.
reg.register_early_lint_pass(box else_if_without_else::ElseIfWithoutElse);
// ...
- reg.register_lint_group("clippy_restriction", vec![
+ reg.register_lint_group("clippy::restriction", vec![
// ...
else_if_without_else::ELSE_IF_WITHOUT_ELSE,
// ...
```
The [`rustc_plugin::PluginRegistry`][plugin_registry] provides two methods to register lints: [register_early_lint_pass][reg_early_lint_pass] and [register_late_lint_pass][reg_late_lint_pass].
-Both take an object that implements an [`EarlyLintPass`][early_lint_pass] or [`LateLintPass`][late_lint_pass] respectively. This is done in every single lint.
+Both take an object that implements an [`EarlyLintPass`][early_lint_pass] or [`LateLintPass`][late_lint_pass] respectively. This is done in every single lint.
It's worth noting that the majority of `clippy_lints/src/lib.rs` is autogenerated by `util/update_lints.py` and you don't have to add anything by hand. When you are writing your own lint, you can use that script to save you some time.
```rust
// ./clippy_lints/src/else_if_without_else.rs
-use rustc::lint::*;
+use rustc::lint::{EarlyLintPass, LintArray, LintPass};
// ...