7
7
extern crate rustc_driver;
8
8
extern crate syntax;
9
9
10
- use rustc:: lint:: { LateContext , LintContext , LintPass , LateLintPass , LateLintPassObject , LintArray } ;
10
+ use rustc:: lint:: { LateContext , LintContext , LintPass , LateLintPass } ;
11
11
use rustc_driver:: plugin:: Registry ;
12
12
use rustc:: hir;
13
13
use syntax:: attr;
14
14
use syntax:: symbol:: Symbol ;
15
15
16
16
macro_rules! fake_lint_pass {
17
- ( $struct: ident, $lints : expr , $ ( $attr: expr) ,* ) => {
17
+ ( $struct: ident, $( $attr: expr) ,* ) => {
18
18
struct $struct;
19
19
20
20
impl LintPass for $struct {
21
21
fn name( & self ) -> & ' static str {
22
22
stringify!( $struct)
23
23
}
24
-
25
- fn get_lints( & self ) -> LintArray {
26
- $lints
27
- }
28
24
}
29
25
30
26
impl <' a, ' tcx> LateLintPass <' a, ' tcx> for $struct {
@@ -49,25 +45,29 @@ declare_lint!(CRATE_NOT_GREEN, Warn, "crate not marked with #![crate_green]");
49
45
50
46
fake_lint_pass ! {
51
47
PassOkay ,
52
- lint_array!( CRATE_NOT_OKAY ) , // Single lint
53
48
Symbol :: intern( "rustc_crate_okay" )
54
49
}
55
50
56
51
fake_lint_pass ! {
57
52
PassRedBlue ,
58
- lint_array!( CRATE_NOT_RED , CRATE_NOT_BLUE ) , // Multiple lints
59
53
Symbol :: intern( "rustc_crate_red" ) , Symbol :: intern( "rustc_crate_blue" )
60
54
}
61
55
62
56
fake_lint_pass ! {
63
57
PassGreyGreen ,
64
- lint_array!( CRATE_NOT_GREY , CRATE_NOT_GREEN , ) , // Trailing comma
65
58
Symbol :: intern( "rustc_crate_grey" ) , Symbol :: intern( "rustc_crate_green" )
66
59
}
67
60
68
61
#[ plugin_registrar]
69
62
pub fn plugin_registrar ( reg : & mut Registry ) {
70
- reg. register_late_lint_pass ( box PassOkay ) ;
71
- reg. register_late_lint_pass ( box PassRedBlue ) ;
72
- reg. register_late_lint_pass ( box PassGreyGreen ) ;
63
+ reg. lint_store . register_lints ( & [
64
+ & CRATE_NOT_OKAY ,
65
+ & CRATE_NOT_RED ,
66
+ & CRATE_NOT_BLUE ,
67
+ & CRATE_NOT_GREY ,
68
+ & CRATE_NOT_GREEN ,
69
+ ] ) ;
70
+ reg. lint_store . register_late_pass ( || box PassOkay ) ;
71
+ reg. lint_store . register_late_pass ( || box PassRedBlue ) ;
72
+ reg. lint_store . register_late_pass ( || box PassGreyGreen ) ;
73
73
}
0 commit comments