1
1
// error-pattern:yummy
2
2
#![ feature( box_syntax) ]
3
3
#![ feature( rustc_private) ]
4
-
5
4
#![ allow( unknown_lints, missing_docs_in_private_items) ]
6
5
7
6
extern crate clippy_lints;
@@ -12,9 +11,9 @@ extern crate rustc_errors;
12
11
extern crate rustc_plugin;
13
12
extern crate syntax;
14
13
15
- use rustc_driver:: { driver, CompilerCalls , RustcDefaultCalls , Compilation } ;
16
- use rustc:: session:: { config, Session , CompileIncomplete } ;
17
- use rustc:: session:: config:: { Input , ErrorOutputType } ;
14
+ use rustc_driver:: { driver, Compilation , CompilerCalls , RustcDefaultCalls } ;
15
+ use rustc:: session:: { config, CompileIncomplete , Session } ;
16
+ use rustc:: session:: config:: { ErrorOutputType , Input } ;
18
17
use std:: collections:: HashMap ;
19
18
use std:: path:: PathBuf ;
20
19
use std:: process:: { self , Command } ;
@@ -200,9 +199,9 @@ pub fn main() {
200
199
if let Some ( "clippy" ) = std:: env:: args ( ) . nth ( 1 ) . as_ref ( ) . map ( AsRef :: as_ref) {
201
200
// this arm is executed on the initial call to `cargo clippy`
202
201
203
- let manifest_path_arg = std:: env:: args ( ) . skip ( 2 ) . find ( |val| {
204
- val . starts_with ( "--manifest-path=" )
205
- } ) ;
202
+ let manifest_path_arg = std:: env:: args ( )
203
+ . skip ( 2 )
204
+ . find ( |val| val . starts_with ( "--manifest-path=" ) ) ;
206
205
207
206
let mut metadata =
208
207
if let Ok ( metadata) = cargo_metadata:: metadata ( manifest_path_arg. as_ref ( ) . map ( AsRef :: as_ref) ) {
@@ -218,15 +217,15 @@ pub fn main() {
218
217
. expect ( "manifest path could not be canonicalized" )
219
218
} ) ;
220
219
221
- let packages = if std:: env:: args ( ) . any ( |a| a == "--all" ) {
220
+ let packages = if std:: env:: args ( ) . any ( |a| a == "--all" ) {
222
221
metadata. packages
223
222
} else {
224
223
let package_index = {
225
224
if let Some ( manifest_path) = manifest_path {
226
225
metadata. packages . iter ( ) . position ( |package| {
227
- let package_manifest_path = Path :: new ( & package. manifest_path ) . canonicalize ( ) . expect (
228
- "package manifest path could not be canonicalized" ,
229
- ) ;
226
+ let package_manifest_path = Path :: new ( & package. manifest_path )
227
+ . canonicalize ( )
228
+ . expect ( "package manifest path could not be canonicalized" ) ;
230
229
package_manifest_path == manifest_path
231
230
} )
232
231
} else {
@@ -261,9 +260,9 @@ pub fn main() {
261
260
// code
262
261
// the call to `cargo_metadata::metadata` must have succeeded. So it's okay to
263
262
// unwrap the current path's parent.
264
- current_path = current_path. parent ( ) . unwrap_or_else ( || {
265
- panic ! ( "could not find parent of path {}" , current_path . display ( ) )
266
- } ) ;
263
+ current_path = current_path
264
+ . parent ( )
265
+ . unwrap_or_else ( || panic ! ( "could not find parent of path {}" , current_path . display ( ) ) ) ;
267
266
}
268
267
}
269
268
}
@@ -276,7 +275,9 @@ pub fn main() {
276
275
let manifest_path = package. manifest_path ;
277
276
278
277
for target in package. targets {
279
- let args = std:: env:: args ( ) . skip ( 2 ) . filter ( |a| a != "--all" && !a. starts_with ( "--manifest-path=" ) ) ;
278
+ let args = std:: env:: args ( )
279
+ . skip ( 2 )
280
+ . filter ( |a| a != "--all" && !a. starts_with ( "--manifest-path=" ) ) ;
280
281
281
282
let args = std:: iter:: once ( format ! ( "--manifest-path={}" , manifest_path) ) . chain ( args) ;
282
283
if let Some ( first) = target. kind . get ( 0 ) {
@@ -289,8 +290,7 @@ pub fn main() {
289
290
vec ! [ format!( "--{}" , first) , target. name]
290
291
. into_iter ( )
291
292
. chain ( args) ,
292
- )
293
- {
293
+ ) {
294
294
std:: process:: exit ( code) ;
295
295
}
296
296
}
0 commit comments