@@ -45,26 +45,7 @@ pub fn create(pass: Option<&str>, lint_name: Option<&str>, category: Option<&str
45
45
}
46
46
47
47
fn create_lint ( lint : & LintData < ' _ > , enable_msrv : bool ) -> io:: Result < ( ) > {
48
- let ( pass_type, pass_lifetimes, pass_import, context_import) = match lint. pass {
49
- "early" => ( "EarlyLintPass" , "" , "use rustc_ast::ast::*;" , "EarlyContext" ) ,
50
- "late" => ( "LateLintPass" , "<'_>" , "use rustc_hir::*;" , "LateContext" ) ,
51
- _ => {
52
- unreachable ! ( "`pass_type` should only ever be `early` or `late`!" ) ;
53
- } ,
54
- } ;
55
-
56
- let camel_case_name = to_camel_case ( lint. name ) ;
57
- let lint_contents = get_lint_file_contents (
58
- lint. pass ,
59
- pass_type,
60
- pass_lifetimes,
61
- lint. name ,
62
- & camel_case_name,
63
- lint. category ,
64
- pass_import,
65
- context_import,
66
- enable_msrv,
67
- ) ;
48
+ let lint_contents = get_lint_file_contents ( lint, enable_msrv) ;
68
49
69
50
let lint_path = format ! ( "clippy_lints/src/{}.rs" , lint. name) ;
70
51
write_file ( lint. project_root . join ( & lint_path) , lint_contents. as_bytes ( ) )
@@ -156,20 +137,21 @@ publish = false
156
137
)
157
138
}
158
139
159
- fn get_lint_file_contents (
160
- pass_name : & str ,
161
- pass_type : & str ,
162
- pass_lifetimes : & str ,
163
- lint_name : & str ,
164
- camel_case_name : & str ,
165
- category : & str ,
166
- pass_import : & str ,
167
- context_import : & str ,
168
- enable_msrv : bool ,
169
- ) -> String {
140
+ fn get_lint_file_contents ( lint : & LintData < ' _ > , enable_msrv : bool ) -> String {
170
141
let mut result = String :: new ( ) ;
171
142
172
- let name_camel = camel_case_name;
143
+ let ( pass_type, pass_lifetimes, pass_import, context_import) = match lint. pass {
144
+ "early" => ( "EarlyLintPass" , "" , "use rustc_ast::ast::*;" , "EarlyContext" ) ,
145
+ "late" => ( "LateLintPass" , "<'_>" , "use rustc_hir::*;" , "LateContext" ) ,
146
+ _ => {
147
+ unreachable ! ( "`pass_type` should only ever be `early` or `late`!" ) ;
148
+ } ,
149
+ } ;
150
+
151
+ let lint_name = lint. name ;
152
+ let pass_name = lint. pass ;
153
+ let category = lint. category ;
154
+ let name_camel = to_camel_case ( lint. name ) ;
173
155
let name_upper = lint_name. to_uppercase ( ) ;
174
156
175
157
result. push_str ( & if enable_msrv {
0 commit comments