@@ -12,7 +12,7 @@ extern crate rustc_plugin;
12
12
extern crate syntax;
13
13
14
14
use rustc_driver:: { driver, Compilation , CompilerCalls , RustcDefaultCalls } ;
15
- use rustc:: session:: { config, CompileIncomplete , Session } ;
15
+ use rustc:: session:: { config, Session } ;
16
16
use rustc:: session:: config:: { ErrorOutputType , Input } ;
17
17
use std:: path:: PathBuf ;
18
18
use std:: process:: Command ;
@@ -153,47 +153,44 @@ pub fn main() {
153
153
} )
154
154
. expect ( "need to specify SYSROOT env var during clippy compilation, or use rustup or multirust" ) ;
155
155
156
- rustc_driver:: in_rustc_thread ( || {
157
- // Setting RUSTC_WRAPPER causes Cargo to pass 'rustc' as the first argument.
158
- // We're invoking the compiler programmatically, so we ignore this/
159
- let mut orig_args: Vec < String > = env:: args ( ) . collect ( ) ;
160
- if orig_args. len ( ) <= 1 {
161
- std:: process:: exit ( 1 ) ;
162
- }
163
- if orig_args[ 1 ] == "rustc" {
164
- // we still want to be able to invoke it normally though
165
- orig_args. remove ( 1 ) ;
166
- }
167
- // this conditional check for the --sysroot flag is there so users can call
168
- // `clippy_driver` directly
169
- // without having to pass --sysroot or anything
170
- let mut args: Vec < String > = if orig_args. iter ( ) . any ( |s| s == "--sysroot" ) {
171
- orig_args. clone ( )
172
- } else {
173
- orig_args
174
- . clone ( )
175
- . into_iter ( )
176
- . chain ( Some ( "--sysroot" . to_owned ( ) ) )
177
- . chain ( Some ( sys_root) )
178
- . collect ( )
179
- } ;
180
-
181
- // this check ensures that dependencies are built but not linted and the final
182
- // crate is
183
- // linted but not built
184
- let clippy_enabled = env:: var ( "CLIPPY_TESTS" )
185
- . ok ( )
186
- . map_or ( false , |val| val == "true" )
187
- || orig_args. iter ( ) . any ( |s| s == "--emit=metadata" ) ;
188
-
189
- if clippy_enabled {
190
- args. extend_from_slice ( & [ "--cfg" . to_owned ( ) , r#"feature="cargo-clippy""# . to_owned ( ) ] ) ;
191
- }
156
+ // Setting RUSTC_WRAPPER causes Cargo to pass 'rustc' as the first argument.
157
+ // We're invoking the compiler programmatically, so we ignore this/
158
+ let mut orig_args: Vec < String > = env:: args ( ) . collect ( ) ;
159
+ if orig_args. len ( ) <= 1 {
160
+ std:: process:: exit ( 1 ) ;
161
+ }
162
+ if orig_args[ 1 ] == "rustc" {
163
+ // we still want to be able to invoke it normally though
164
+ orig_args. remove ( 1 ) ;
165
+ }
166
+ // this conditional check for the --sysroot flag is there so users can call
167
+ // `clippy_driver` directly
168
+ // without having to pass --sysroot or anything
169
+ let mut args: Vec < String > = if orig_args. iter ( ) . any ( |s| s == "--sysroot" ) {
170
+ orig_args. clone ( )
171
+ } else {
172
+ orig_args
173
+ . clone ( )
174
+ . into_iter ( )
175
+ . chain ( Some ( "--sysroot" . to_owned ( ) ) )
176
+ . chain ( Some ( sys_root) )
177
+ . collect ( )
178
+ } ;
179
+
180
+ // this check ensures that dependencies are built but not linted and the final
181
+ // crate is
182
+ // linted but not built
183
+ let clippy_enabled = env:: var ( "CLIPPY_TESTS" )
184
+ . ok ( )
185
+ . map_or ( false , |val| val == "true" )
186
+ || orig_args. iter ( ) . any ( |s| s == "--emit=metadata" ) ;
187
+
188
+ if clippy_enabled {
189
+ args. extend_from_slice ( & [ "--cfg" . to_owned ( ) , r#"feature="cargo-clippy""# . to_owned ( ) ] ) ;
190
+ }
192
191
193
- let mut ccc = ClippyCompilerCalls :: new ( clippy_enabled) ;
194
- let ( result, _) = rustc_driver:: run_compiler ( & args, & mut ccc, None , None ) ;
195
- if let Err ( CompileIncomplete :: Errored ( _) ) = result {
196
- std:: process:: exit ( 1 ) ;
197
- }
198
- } ) . expect ( "rustc_thread failed" ) ;
192
+ let mut ccc = ClippyCompilerCalls :: new ( clippy_enabled) ;
193
+ rustc_driver:: run ( move || {
194
+ rustc_driver:: run_compiler ( & args, & mut ccc, None , None )
195
+ } ) ;
199
196
}
0 commit comments