77extern crate rustc_driver;
88extern crate syntax;
99
10- use rustc:: lint:: { LateContext , LintContext , LintPass , LateLintPass , LateLintPassObject , LintArray } ;
10+ use rustc:: lint:: { LateContext , LintContext , LintPass , LateLintPass } ;
1111use rustc_driver:: plugin:: Registry ;
1212use rustc:: hir;
1313use syntax:: attr;
1414use syntax:: symbol:: Symbol ;
1515
1616macro_rules! fake_lint_pass {
17- ( $struct: ident, $lints : expr , $ ( $attr: expr) ,* ) => {
17+ ( $struct: ident, $( $attr: expr) ,* ) => {
1818 struct $struct;
1919
2020 impl LintPass for $struct {
2121 fn name( & self ) -> & ' static str {
2222 stringify!( $struct)
2323 }
24-
25- fn get_lints( & self ) -> LintArray {
26- $lints
27- }
2824 }
2925
3026 impl <' a, ' tcx> LateLintPass <' a, ' tcx> for $struct {
@@ -49,25 +45,29 @@ declare_lint!(CRATE_NOT_GREEN, Warn, "crate not marked with #![crate_green]");
4945
5046fake_lint_pass ! {
5147 PassOkay ,
52- lint_array!( CRATE_NOT_OKAY ) , // Single lint
5348 Symbol :: intern( "rustc_crate_okay" )
5449}
5550
5651fake_lint_pass ! {
5752 PassRedBlue ,
58- lint_array!( CRATE_NOT_RED , CRATE_NOT_BLUE ) , // Multiple lints
5953 Symbol :: intern( "rustc_crate_red" ) , Symbol :: intern( "rustc_crate_blue" )
6054}
6155
6256fake_lint_pass ! {
6357 PassGreyGreen ,
64- lint_array!( CRATE_NOT_GREY , CRATE_NOT_GREEN , ) , // Trailing comma
6558 Symbol :: intern( "rustc_crate_grey" ) , Symbol :: intern( "rustc_crate_green" )
6659}
6760
6861#[ plugin_registrar]
6962pub 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 ) ;
7373}
0 commit comments