|
8 | 8 | #[allow(unused_extern_crates)] |
9 | 9 | extern crate rustc_driver; |
10 | 10 | #[allow(unused_extern_crates)] |
11 | | -extern crate rustc_plugin; |
12 | | -#[allow(unused_extern_crates)] |
13 | 11 | extern crate rustc_interface; |
| 12 | +#[allow(unused_extern_crates)] |
| 13 | +extern crate rustc_plugin; |
14 | 14 |
|
15 | 15 | use rustc_interface::interface; |
16 | 16 | use std::path::Path; |
@@ -69,10 +69,14 @@ impl rustc_driver::Callbacks for ClippyCallbacks { |
69 | 69 | let sess = compiler.session(); |
70 | 70 | let mut registry = rustc_plugin::registry::Registry::new( |
71 | 71 | sess, |
72 | | - compiler.parse().expect( |
73 | | - "at this compilation stage \ |
74 | | - the crate must be parsed", |
75 | | - ).peek().span, |
| 72 | + compiler |
| 73 | + .parse() |
| 74 | + .expect( |
| 75 | + "at this compilation stage \ |
| 76 | + the crate must be parsed", |
| 77 | + ) |
| 78 | + .peek() |
| 79 | + .span, |
76 | 80 | ); |
77 | 81 | registry.args_hidden = Some(Vec::new()); |
78 | 82 |
|
@@ -195,13 +199,12 @@ pub fn main() { |
195 | 199 |
|
196 | 200 | let mut clippy = ClippyCallbacks; |
197 | 201 | let mut default = rustc_driver::DefaultCallbacks; |
198 | | - let callbacks: &mut (dyn rustc_driver::Callbacks + Send) = if clippy_enabled { |
199 | | - &mut clippy |
200 | | - } else { |
201 | | - &mut default |
202 | | - }; |
| 202 | + let callbacks: &mut (dyn rustc_driver::Callbacks + Send) = |
| 203 | + if clippy_enabled { &mut clippy } else { &mut default }; |
203 | 204 | let args = args; |
204 | 205 | rustc_driver::run_compiler(&args, callbacks, None, None) |
205 | | - }).and_then(|result| result).is_err() as i32 |
| 206 | + }) |
| 207 | + .and_then(|result| result) |
| 208 | + .is_err() as i32, |
206 | 209 | ) |
207 | 210 | } |
0 commit comments