@@ -11,9 +11,9 @@ pub fn create(pass: Option<&str>, lint_name: Option<&str>, category: Option<&str
11
11
12
12
match open_files ( lint_name) {
13
13
Ok ( ( mut test_file, mut lint_file) ) => {
14
- let ( pass_type, pass_import, context_import) = match pass {
15
- "early" => ( "EarlyLintPass" , "use syntax::ast::*;" , "EarlyContext" ) ,
16
- "late" => ( "LateLintPass" , "use rustc_hir::*;" , "LateContext" ) ,
14
+ let ( pass_type, pass_lifetimes , pass_import, context_import) = match pass {
15
+ "early" => ( "EarlyLintPass" , "" , " use syntax::ast::*;", "EarlyContext" ) ,
16
+ "late" => ( "LateLintPass" , "<'_, '_>" , " use rustc_hir::*;", "LateContext" ) ,
17
17
_ => {
18
18
unreachable ! ( "`pass_type` should only ever be `early` or `late`!" ) ;
19
19
} ,
@@ -31,6 +31,7 @@ pub fn create(pass: Option<&str>, lint_name: Option<&str>, category: Option<&str
31
31
if let Err ( e) = lint_file. write_all (
32
32
get_lint_file_contents (
33
33
pass_type,
34
+ pass_lifetimes,
34
35
lint_name,
35
36
& camel_case_name,
36
37
category,
@@ -125,14 +126,15 @@ fn main() {{
125
126
126
127
fn get_lint_file_contents (
127
128
pass_type : & str ,
129
+ pass_lifetimes : & str ,
128
130
lint_name : & str ,
129
131
camel_case_name : & str ,
130
132
category : & str ,
131
133
pass_import : & str ,
132
134
context_import : & str ,
133
135
) -> String {
134
136
format ! (
135
- "use rustc::lint ::{{LintArray, LintPass, {type}, {context_import}}};
137
+ "use rustc_lint ::{{LintArray, LintPass, {type}, {context_import}}};
136
138
use rustc_session::{{declare_lint_pass, declare_tool_lint}};
137
139
{pass_import}
138
140
@@ -155,9 +157,10 @@ declare_clippy_lint! {{
155
157
156
158
declare_lint_pass!({name_camel} => [{name_upper}]);
157
159
158
- impl {type} for {name_camel} {{}}
160
+ impl {type}{lifetimes} for {name_camel} {{}}
159
161
" ,
160
162
type =pass_type,
163
+ lifetimes=pass_lifetimes,
161
164
name_upper=lint_name. to_uppercase( ) ,
162
165
name_camel=camel_case_name,
163
166
category=category,
0 commit comments