Skip to content

Commit 654ff18

Browse files
committed
deprecate clippy-as-a-plugin
1 parent 0f5be36 commit 654ff18

File tree

1 file changed

+0
-91
lines changed

1 file changed

+0
-91
lines changed

README.md

Lines changed: 0 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -71,44 +71,6 @@ similar crates.
7171
SYSROOT=/path/to/rustc/sysroot cargo install clippy
7272
```
7373

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

11476
To have cargo compile your crate with clippy without clippy installation and without needing `#![plugin(clippy)]`
@@ -121,53 +83,6 @@ cargo run --bin cargo-clippy --manifest-path=path_to_clippys_Cargo.toml
12183
*[Note](https://github.com/rust-lang-nursery/rust-clippy/wiki#a-word-of-warning):*
12284
Be sure that clippy was compiled with the same version of rustc that cargo invokes here!
12385

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

17388
Some lints can be configured in a TOML file named with `clippy.toml` or `.clippy.toml`. It contains basic `variable = value` mapping eg.
@@ -180,12 +95,6 @@ cyclomatic-complexity-threshold = 30
18095
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
18196
meaning of the variables.
18297

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

0 commit comments

Comments
 (0)