@@ -5,11 +5,13 @@ extern crate syntax;
55
66// Load rustc as a plugin to get macros
77extern crate rustc_driver;
8- #[ macro_use] extern crate rustc_lint;
9- #[ macro_use] extern crate rustc_session;
8+ #[ macro_use]
9+ extern crate rustc_lint;
10+ #[ macro_use]
11+ extern crate rustc_session;
1012
11- use rustc_lint:: { EarlyContext , EarlyLintPass , LintArray , LintContext , LintPass , LintId } ;
1213use rustc_driver:: plugin:: Registry ;
14+ use rustc_lint:: { EarlyContext , EarlyLintPass , LintArray , LintContext , LintId , LintPass } ;
1315use syntax:: ast;
1416declare_tool_lint ! ( pub clippy:: TEST_LINT , Warn , "Warn about stuff" ) ;
1517declare_tool_lint ! (
@@ -30,10 +32,14 @@ declare_lint_pass!(Pass => [TEST_LINT, TEST_GROUP, TEST_RUSTC_TOOL_LINT]);
3032impl EarlyLintPass for Pass {
3133 fn check_item ( & mut self , cx : & EarlyContext , it : & ast:: Item ) {
3234 if it. ident . name . as_str ( ) == "lintme" {
33- cx. span_lint ( TEST_LINT , it. span , "item is named 'lintme'" ) ;
35+ cx. lint ( TEST_LINT , |lint| {
36+ lint. build ( "item is named 'lintme'" ) . set_span ( it. span ) . emit ( )
37+ } ) ;
3438 }
3539 if it. ident . name . as_str ( ) == "lintmetoo" {
36- cx. span_lint ( TEST_GROUP , it. span , "item is named 'lintmetoo'" ) ;
40+ cx. lint ( TEST_GROUP , |lint| {
41+ lint. build ( "item is named 'lintmetoo'" ) . set_span ( it. span ) . emit ( )
42+ } ) ;
3743 }
3844 }
3945}
@@ -42,6 +48,10 @@ impl EarlyLintPass for Pass {
4248pub fn plugin_registrar ( reg : & mut Registry ) {
4349 reg. lint_store . register_lints ( & [ & TEST_RUSTC_TOOL_LINT , & TEST_LINT , & TEST_GROUP ] ) ;
4450 reg. lint_store . register_early_pass ( || box Pass ) ;
45- reg. lint_store . register_group ( true , "clippy::group" , Some ( "clippy_group" ) ,
46- vec ! [ LintId :: of( & TEST_LINT ) , LintId :: of( & TEST_GROUP ) ] ) ;
51+ reg. lint_store . register_group (
52+ true ,
53+ "clippy::group" ,
54+ Some ( "clippy_group" ) ,
55+ vec ! [ LintId :: of( & TEST_LINT ) , LintId :: of( & TEST_GROUP ) ] ,
56+ ) ;
4757}
0 commit comments