@@ -15,6 +15,8 @@ use rustc_tools_util::*;
15
15
use std:: path:: Path ;
16
16
use std:: process:: { exit, Command } ;
17
17
18
+ mod lintlist;
19
+
18
20
/// If a command-line option matches `find_arg`, then apply the predicate `pred` on its value. If
19
21
/// true, then return it. The parameter is assumed to be either `--arg=value` or `--arg value`.
20
22
fn arg_value < ' a > (
@@ -120,6 +122,40 @@ pub fn main() {
120
122
exit ( 0 ) ;
121
123
}
122
124
125
+ if std:: env:: args ( ) . any ( |a| a == "--help" || a == "-h" ) {
126
+ println ! (
127
+ "\
128
+ Checks a package to catch common mistakes and improve your Rust code.
129
+
130
+ Usage:
131
+ cargo clippy [options] [--] [<opts>...]
132
+
133
+ Common options:
134
+ -h, --help Print this message
135
+ -V, --version Print version info and exit
136
+
137
+ Other options are the same as `cargo check`.
138
+
139
+ To allow or deny a lint from the command line you can use `cargo clippy --`
140
+ with:
141
+
142
+ -W --warn OPT Set lint warnings
143
+ -A --allow OPT Set lint allowed
144
+ -D --deny OPT Set lint denied
145
+ -F --forbid OPT Set lint forbidden
146
+
147
+ You can use tool lints to allow or deny lints from your code, eg.:
148
+
149
+ #[allow(clippy::needless_lifetimes)]
150
+ "
151
+ ) ;
152
+
153
+ for lint in & lintlist:: ALL_LINTS [ ..] {
154
+ println ! ( "clippy::{}," , lint. name) ;
155
+ }
156
+ exit ( 0 ) ;
157
+ }
158
+
123
159
let mut orig_args: Vec < String > = env:: args ( ) . collect ( ) ;
124
160
125
161
// Get the sysroot, looking from most specific to this invocation to the least:
0 commit comments