@@ -38,30 +38,17 @@ impl ClippyCompilerCalls {
38
38
}
39
39
40
40
impl < ' a > CompilerCalls < ' a > for ClippyCompilerCalls {
41
- fn early_callback ( & mut self ,
42
- matches : & getopts:: Matches ,
43
- sopts : & config:: Options ,
44
- cfg : & ast:: CrateConfig ,
45
- descriptions : & rustc_errors:: registry:: Registry ,
46
- output : ErrorOutputType )
41
+ fn early_callback ( & mut self , matches : & getopts:: Matches , sopts : & config:: Options , cfg : & ast:: CrateConfig ,
42
+ descriptions : & rustc_errors:: registry:: Registry , output : ErrorOutputType )
47
43
-> Compilation {
48
44
self . default . early_callback ( matches, sopts, cfg, descriptions, output)
49
45
}
50
- fn no_input ( & mut self ,
51
- matches : & getopts:: Matches ,
52
- sopts : & config:: Options ,
53
- cfg : & ast:: CrateConfig ,
54
- odir : & Option < PathBuf > ,
55
- ofile : & Option < PathBuf > ,
56
- descriptions : & rustc_errors:: registry:: Registry )
46
+ fn no_input ( & mut self , matches : & getopts:: Matches , sopts : & config:: Options , cfg : & ast:: CrateConfig ,
47
+ odir : & Option < PathBuf > , ofile : & Option < PathBuf > , descriptions : & rustc_errors:: registry:: Registry )
57
48
-> Option < ( Input , Option < PathBuf > ) > {
58
49
self . default . no_input ( matches, sopts, cfg, odir, ofile, descriptions)
59
50
}
60
- fn late_callback ( & mut self ,
61
- matches : & getopts:: Matches ,
62
- sess : & Session ,
63
- input : & Input ,
64
- odir : & Option < PathBuf > ,
51
+ fn late_callback ( & mut self , matches : & getopts:: Matches , sess : & Session , input : & Input , odir : & Option < PathBuf > ,
65
52
ofile : & Option < PathBuf > )
66
53
-> Compilation {
67
54
self . default . late_callback ( matches, sess, input, odir, ofile)
@@ -73,7 +60,12 @@ impl<'a> CompilerCalls<'a> for ClippyCompilerCalls {
73
60
let old = std:: mem:: replace ( & mut control. after_parse . callback , box |_| { } ) ;
74
61
control. after_parse . callback = Box :: new ( move |state| {
75
62
{
76
- let mut registry = rustc_plugin:: registry:: Registry :: new ( state. session , state. krate . as_ref ( ) . expect ( "at this compilation stage the krate must be parsed" ) . span ) ;
63
+ let mut registry = rustc_plugin:: registry:: Registry :: new ( state. session ,
64
+ state. krate
65
+ . as_ref ( )
66
+ . expect ( "at this compilation stage \
67
+ the krate must be parsed")
68
+ . span ) ;
77
69
registry. args_hidden = Some ( Vec :: new ( ) ) ;
78
70
clippy_lints:: register_plugins ( & mut registry) ;
79
71
@@ -153,7 +145,7 @@ pub fn main() {
153
145
if env:: var ( "CLIPPY_DOGFOOD" ) . map ( |_| true ) . unwrap_or ( false ) {
154
146
panic ! ( "yummy" ) ;
155
147
}
156
-
148
+
157
149
// Check for version and help flags even when invoked as 'cargo-clippy'
158
150
if std:: env:: args ( ) . any ( |a| a == "--help" || a == "-h" ) {
159
151
show_help ( ) ;
@@ -184,14 +176,16 @@ pub fn main() {
184
176
185
177
let current_dir = std:: env:: current_dir ( ) ;
186
178
187
- let package_index = metadata. packages . iter ( )
179
+ let package_index = metadata. packages
180
+ . iter ( )
188
181
. position ( |package| {
189
182
let package_manifest_path = Path :: new ( & package. manifest_path ) ;
190
183
if let Some ( ref manifest_path) = manifest_path {
191
184
package_manifest_path == manifest_path
192
185
} else {
193
186
let current_dir = current_dir. as_ref ( ) . expect ( "could not read current directory" ) ;
194
- let package_manifest_directory = package_manifest_path. parent ( ) . expect ( "could not find parent directory of package manifest" ) ;
187
+ let package_manifest_directory = package_manifest_path. parent ( )
188
+ . expect ( "could not find parent directory of package manifest" ) ;
195
189
package_manifest_directory == current_dir
196
190
}
197
191
} )
@@ -205,7 +199,8 @@ pub fn main() {
205
199
std:: process:: exit ( code) ;
206
200
}
207
201
} else if [ "bin" , "example" , "test" , "bench" ] . contains ( & & * * first) {
208
- if let Err ( code) = process ( vec ! [ format!( "--{}" , first) , target. name] . into_iter ( ) . chain ( args) , & dep_path) {
202
+ if let Err ( code) = process ( vec ! [ format!( "--{}" , first) , target. name] . into_iter ( ) . chain ( args) ,
203
+ & dep_path) {
209
204
std:: process:: exit ( code) ;
210
205
}
211
206
}
@@ -285,8 +280,10 @@ fn process<P, I>(old_args: I, dep_path: P) -> Result<(), i32>
285
280
let exit_status = std:: process:: Command :: new ( "cargo" )
286
281
. args ( & args)
287
282
. env ( "RUSTC" , path)
288
- . spawn ( ) . expect ( "could not run cargo" )
289
- . wait ( ) . expect ( "failed to wait for cargo?" ) ;
283
+ . spawn ( )
284
+ . expect ( "could not run cargo" )
285
+ . wait ( )
286
+ . expect ( "failed to wait for cargo?" ) ;
290
287
291
288
if exit_status. success ( ) {
292
289
Ok ( ( ) )
0 commit comments