@@ -96,8 +96,7 @@ fn create_test(lint: &LintData<'_>) -> io::Result<()> {
96
96
97
97
path. push ( "src" ) ;
98
98
fs:: create_dir ( & path) ?;
99
- let header = format ! ( "//@compile-flags: --crate-name={lint_name}" ) ;
100
- write_file ( path. join ( "main.rs" ) , get_test_file_contents ( lint_name, Some ( & header) ) ) ?;
99
+ write_file ( path. join ( "main.rs" ) , get_test_file_contents ( lint_name) ) ?;
101
100
102
101
Ok ( ( ) )
103
102
}
@@ -113,7 +112,7 @@ fn create_test(lint: &LintData<'_>) -> io::Result<()> {
113
112
println ! ( "Generated test directories: `{relative_test_dir}/pass`, `{relative_test_dir}/fail`" ) ;
114
113
} else {
115
114
let test_path = format ! ( "tests/ui/{}.rs" , lint. name) ;
116
- let test_contents = get_test_file_contents ( lint. name , None ) ;
115
+ let test_contents = get_test_file_contents ( lint. name ) ;
117
116
write_file ( lint. project_root . join ( & test_path) , test_contents) ?;
118
117
119
118
println ! ( "Generated test file: `{test_path}`" ) ;
@@ -195,23 +194,16 @@ pub(crate) fn get_stabilization_version() -> String {
195
194
parse_manifest ( & contents) . expect ( "Unable to find package version in `Cargo.toml`" )
196
195
}
197
196
198
- fn get_test_file_contents ( lint_name : & str , header_commands : Option < & str > ) -> String {
199
- let mut contents = formatdoc ! (
197
+ fn get_test_file_contents ( lint_name : & str ) -> String {
198
+ formatdoc ! (
200
199
r#"
201
- #![allow(unused)]
202
200
#![warn(clippy::{lint_name})]
203
201
204
202
fn main() {{
205
203
// test code goes here
206
204
}}
207
205
"#
208
- ) ;
209
-
210
- if let Some ( header) = header_commands {
211
- contents = format ! ( "{header}\n {contents}" ) ;
212
- }
213
-
214
- contents
206
+ )
215
207
}
216
208
217
209
fn get_manifest_contents ( lint_name : & str , hint : & str ) -> String {
0 commit comments