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
Be sure that clippy was compiled with the same version of rustc that cargo invokes here!
122
84
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
-
fnmain(){
150
-
letx=Some(1u8);
151
-
matchx {
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
-
170
85
## Configuration
171
86
172
87
Some lints can be configured in a TOML file named with `clippy.toml` or `.clippy.toml`. It contains basic `variable = value` mapping eg.
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
180
95
meaning of the variables.
181
96
182
-
You can also specify the path to the configuration file with:
0 commit comments