Skip to content

Commit d43dbb7

Browse files
authored
Deprecate plugin-clippy and crates.io clippy
1 parent 1742229 commit d43dbb7

File tree

1 file changed

+3
-94
lines changed

1 file changed

+3
-94
lines changed

README.md

Lines changed: 3 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ One way to use clippy is by installing clippy through cargo as a cargo
4848
subcommand.
4949

5050
```terminal
51-
cargo +nightly install clippy
51+
cargo +nightly install clippy --git https://github.com/rust-lang-nursery/rust-clippy.git
5252
```
5353

5454
(The `+nightly` is not necessary if your default `rustup` install is nightly)
@@ -59,53 +59,15 @@ To update the subcommand together with the latest nightly use the [rust-update](
5959

6060
```terminal
6161
rustup update nightly
62-
cargo +nightly install --force clippy
62+
cargo +nightly install --force clippy --git https://github.com/rust-lang-nursery/rust-clippy.git
6363
```
6464

6565
In case you are not using rustup, you need to set the environment flag
6666
`SYSROOT` during installation so clippy knows where to find `librustc` and
6767
similar crates.
6868

6969
```terminal
70-
SYSROOT=/path/to/rustc/sysroot cargo install clippy
71-
```
72-
73-
### Optional dependency
74-
75-
In some cases you might want to include clippy in your project directly, as an
76-
optional dependency. To do this, just modify `Cargo.toml`:
77-
78-
```toml
79-
[dependencies]
80-
clippy = { version = "*", optional = true }
81-
```
82-
83-
And, in your `main.rs` or `lib.rs`, add these lines:
84-
85-
```rust
86-
#![cfg_attr(feature="clippy", feature(plugin))]
87-
#![cfg_attr(feature="clippy", plugin(clippy))]
88-
```
89-
90-
Then build by enabling the feature: `cargo +nightly build --features "clippy"`.
91-
92-
Instead of adding the `cfg_attr` attributes you can also run clippy on demand:
93-
`cargo rustc --features clippy -- -Z no-trans -Z extra-plugins=clippy`
94-
(the `-Z no trans`, while not necessary, will stop the compilation process after
95-
typechecking (and lints) have completed, which can significantly reduce the runtime).
96-
97-
Alternatively, to only run clippy when testing:
98-
99-
```toml
100-
[dev-dependencies]
101-
clippy = { version = "*" }
102-
```
103-
104-
and add to `main.rs` or `lib.rs`:
105-
106-
```
107-
#![cfg_attr(test, feature(plugin))]
108-
#![cfg_attr(test, plugin(clippy))]
70+
SYSROOT=/path/to/rustc/sysroot cargo install clippy --git https://github.com/rust-lang-nursery/rust-clippy.git
10971
```
11072

11173
### Running clippy from the command line without installing it
@@ -120,53 +82,6 @@ cargo run --bin cargo-clippy --manifest-path=path_to_clippys_Cargo.toml
12082
*[Note](https://github.com/rust-lang-nursery/rust-clippy/wiki#a-word-of-warning):*
12183
Be sure that clippy was compiled with the same version of rustc that cargo invokes here!
12284

123-
### As a Compiler Plugin
124-
125-
*Note:* This is not a recommended installation method.
126-
127-
Since stable Rust is backwards compatible, you should be able to
128-
compile your stable programs with nightly Rust with clippy plugged in to
129-
circumvent this.
130-
131-
Add in your `Cargo.toml`:
132-
133-
```toml
134-
[dependencies]
135-
clippy = "*"
136-
```
137-
138-
You then need to add `#![feature(plugin)]` and `#![plugin(clippy)]` to the top
139-
of your crate entry point (`main.rs` or `lib.rs`).
140-
141-
Sample `main.rs`:
142-
143-
```rust
144-
#![feature(plugin)]
145-
146-
#![plugin(clippy)]
147-
148-
149-
fn main(){
150-
let x = Some(1u8);
151-
match x {
152-
Some(y) => println!("{:?}", y),
153-
_ => ()
154-
}
155-
}
156-
```
157-
158-
Produces this warning:
159-
160-
```terminal
161-
src/main.rs:8:5: 11:6 warning: you seem to be trying to use match for destructuring a single type. Consider using `if let`, #[warn(single_match)] on by default
162-
src/main.rs:8 match x {
163-
src/main.rs:9 Some(y) => println!("{:?}", y),
164-
src/main.rs:10 _ => ()
165-
src/main.rs:11 }
166-
src/main.rs:8:5: 11:6 help: Try
167-
if let Some(y) = x { println!("{:?}", y) }
168-
```
169-
17085
## Configuration
17186

17287
Some lints can be configured in a TOML file named with `clippy.toml` or `.clippy.toml`. It contains basic `variable = value` mapping eg.
@@ -179,12 +94,6 @@ cyclomatic-complexity-threshold = 30
17994
See the [list of lints](https://rust-lang-nursery.github.io/rust-clippy/master/index.html) for more information about which lints can be configured and the
18095
meaning of the variables.
18196

182-
You can also specify the path to the configuration file with:
183-
184-
```rust
185-
#![plugin(clippy(conf_file="path/to/clippy's/configuration"))]
186-
```
187-
18897
To deactivate the “for further information visit *lint-link*” message you can
18998
define the `CLIPPY_DISABLE_DOCS_LINKS` environment variable.
19099

0 commit comments

Comments
 (0)