@@ -14,36 +14,42 @@ use std::iter::FromIterator;
1414
1515use run_make_support:: { rustc, tmp_dir} ;
1616
17+ struct PrintCfg {
18+ target : & ' static str ,
19+ includes : & ' static [ & ' static str ] ,
20+ disallow : & ' static [ & ' static str ] ,
21+ }
22+
1723fn main ( ) {
18- check (
19- /* target*/ "x86_64-pc-windows-gnu" ,
20- /* includes*/ & [ "windows" , "target_arch=\" x86_64\" " ] ,
21- /* disallow*/ & [ "unix" ] ,
22- ) ;
23- check (
24- /* target*/ "i686-pc-windows-msvc" ,
25- /* includes*/ & [ "windows" , "target_env=\" msvc\" " ] ,
26- /* disallow*/ & [ "unix" ] ,
27- ) ;
28- check (
29- /* target*/ "i686-apple-darwin" ,
30- /* includes*/ & [ "unix" , "target_os=\" macos\" " , "target_vendor=\" apple\" " ] ,
31- /* disallow*/ & [ "windows" ] ,
32- ) ;
33- check (
34- /* target*/ "i686-unknown-linux-gnu" ,
35- /* includes*/ & [ "unix" , "target_env=\" gnu\" " ] ,
36- /* disallow*/ & [ "windows" ] ,
37- ) ;
38- check (
39- /* target*/ "arm-unknown-linux-gnueabihf" ,
40- /* includes*/ & [ "unix" , "target_abi=\" eabihf\" " ] ,
41- /* disallow*/ & [ "windows" ] ,
42- ) ;
24+ check ( PrintCfg {
25+ target : "x86_64-pc-windows-gnu" ,
26+ includes : & [ "windows" , "target_arch=\" x86_64\" " ] ,
27+ disallow : & [ "unix" ] ,
28+ } ) ;
29+ check ( PrintCfg {
30+ target : "i686-pc-windows-msvc" ,
31+ includes : & [ "windows" , "target_env=\" msvc\" " ] ,
32+ disallow : & [ "unix" ] ,
33+ } ) ;
34+ check ( PrintCfg {
35+ target : "i686-apple-darwin" ,
36+ includes : & [ "unix" , "target_os=\" macos\" " , "target_vendor=\" apple\" " ] ,
37+ disallow : & [ "windows" ] ,
38+ } ) ;
39+ check ( PrintCfg {
40+ target : "i686-unknown-linux-gnu" ,
41+ includes : & [ "unix" , "target_env=\" gnu\" " ] ,
42+ disallow : & [ "windows" ] ,
43+ } ) ;
44+ check ( PrintCfg {
45+ target : "arm-unknown-linux-gnueabihf" ,
46+ includes : & [ "unix" , "target_abi=\" eabihf\" " ] ,
47+ disallow : & [ "windows" ] ,
48+ } ) ;
4349}
4450
45- fn check ( target : & str , includes : & [ & str ] , disallow : & [ & str ] ) {
46- fn _inner ( output : & str , includes : & [ & str ] , disallow : & [ & str ] ) {
51+ fn check ( PrintCfg { target , includes, disallow } : PrintCfg ) {
52+ fn check_ ( output : & str , includes : & [ & str ] , disallow : & [ & str ] ) {
4753 let mut found = HashSet :: < String > :: new ( ) ;
4854 let mut recorded = HashSet :: < String > :: new ( ) ;
4955
@@ -82,7 +88,7 @@ fn check(target: &str, includes: &[&str], disallow: &[&str]) {
8288
8389 let stdout = String :: from_utf8 ( output. stdout ) . unwrap ( ) ;
8490
85- _inner ( & stdout, includes, disallow) ;
91+ check_ ( & stdout, includes, disallow) ;
8692 }
8793
8894 // --print=cfg=PATH
@@ -95,6 +101,6 @@ fn check(target: &str, includes: &[&str], disallow: &[&str]) {
95101
96102 let output = std:: fs:: read_to_string ( & tmp_path) . unwrap ( ) ;
97103
98- _inner ( & output, includes, disallow) ;
104+ check_ ( & output, includes, disallow) ;
99105 }
100106}
0 commit comments