@@ -10,7 +10,7 @@ struct Struct;
1010
1111impl Trait for Struct {
1212 cfg_match ! {
13- cfg ( feature = "blah" ) => {
13+ feature = "blah" => {
1414 fn blah( & self ) {
1515 unimplemented!( ) ;
1616 }
@@ -47,21 +47,21 @@ fn matches_leading_pipe() {
4747#[ test]
4848fn cfg_match_basic ( ) {
4949 cfg_match ! {
50- cfg ( target_pointer_width = "64" ) => { fn f0_( ) -> bool { true } }
50+ target_pointer_width = "64" => { fn f0_( ) -> bool { true } }
5151 }
5252
5353 cfg_match ! {
54- cfg ( unix) => { fn f1_( ) -> bool { true } }
55- cfg ( any( target_os = "macos" , target_os = "linux" ) ) => { fn f1_( ) -> bool { false } }
54+ unix => { fn f1_( ) -> bool { true } }
55+ any( target_os = "macos" , target_os = "linux" ) => { fn f1_( ) -> bool { false } }
5656 }
5757
5858 cfg_match ! {
59- cfg ( target_pointer_width = "32" ) => { fn f2_( ) -> bool { false } }
60- cfg ( target_pointer_width = "64" ) => { fn f2_( ) -> bool { true } }
59+ target_pointer_width = "32" => { fn f2_( ) -> bool { false } }
60+ target_pointer_width = "64" => { fn f2_( ) -> bool { true } }
6161 }
6262
6363 cfg_match ! {
64- cfg ( target_pointer_width = "16" ) => { fn f3_( ) -> i32 { 1 } }
64+ target_pointer_width = "16" => { fn f3_( ) -> i32 { 1 } }
6565 _ => { fn f3_( ) -> i32 { 2 } }
6666 }
6767
@@ -83,7 +83,7 @@ fn cfg_match_basic() {
8383#[ test]
8484fn cfg_match_debug_assertions ( ) {
8585 cfg_match ! {
86- cfg ( debug_assertions) => {
86+ debug_assertions => {
8787 assert!( cfg!( debug_assertions) ) ;
8888 assert_eq!( 4 , 2 +2 ) ;
8989 }
@@ -98,13 +98,13 @@ fn cfg_match_debug_assertions() {
9898#[ test]
9999fn cfg_match_no_duplication_on_64 ( ) {
100100 cfg_match ! {
101- cfg ( windows) => {
101+ windows => {
102102 fn foo( ) { }
103103 }
104- cfg ( unix) => {
104+ unix => {
105105 fn foo( ) { }
106106 }
107- cfg ( target_pointer_width = "64" ) => {
107+ target_pointer_width = "64" => {
108108 fn foo( ) { }
109109 }
110110 }
@@ -114,34 +114,34 @@ fn cfg_match_no_duplication_on_64() {
114114#[ test]
115115fn cfg_match_options ( ) {
116116 cfg_match ! {
117- cfg ( test) => {
117+ test => {
118118 use core:: option:: Option as Option2 ;
119119 fn works1( ) -> Option2 <u32 > { Some ( 1 ) }
120120 }
121121 _ => { fn works1( ) -> Option <u32 > { None } }
122122 }
123123
124124 cfg_match ! {
125- cfg ( feature = "foo" ) => { fn works2( ) -> bool { false } }
126- cfg ( test) => { fn works2( ) -> bool { true } }
125+ feature = "foo" => { fn works2( ) -> bool { false } }
126+ test => { fn works2( ) -> bool { true } }
127127 _ => { fn works2( ) -> bool { false } }
128128 }
129129
130130 cfg_match ! {
131- cfg ( feature = "foo" ) => { fn works3( ) -> bool { false } }
131+ feature = "foo" => { fn works3( ) -> bool { false } }
132132 _ => { fn works3( ) -> bool { true } }
133133 }
134134
135135 cfg_match ! {
136- cfg ( test) => {
136+ test => {
137137 use core:: option:: Option as Option3 ;
138138 fn works4( ) -> Option3 <u32 > { Some ( 1 ) }
139139 }
140140 }
141141
142142 cfg_match ! {
143- cfg ( feature = "foo" ) => { fn works5( ) -> bool { false } }
144- cfg ( test) => { fn works5( ) -> bool { true } }
143+ feature = "foo" => { fn works5( ) -> bool { false } }
144+ test => { fn works5( ) -> bool { true } }
145145 }
146146
147147 assert ! ( works1( ) . is_some( ) ) ;
@@ -154,7 +154,7 @@ fn cfg_match_options() {
154154#[ test]
155155fn cfg_match_two_functions ( ) {
156156 cfg_match ! {
157- cfg ( target_pointer_width = "64" ) => {
157+ target_pointer_width = "64" => {
158158 fn foo1( ) { }
159159 fn bar1( ) { }
160160 }
@@ -178,7 +178,7 @@ fn cfg_match_two_functions() {
178178
179179fn _accepts_expressions ( ) -> i32 {
180180 cfg_match ! {
181- cfg ( unix) => { 1 }
181+ unix => { 1 }
182182 _ => { 2 }
183183 }
184184}
@@ -189,7 +189,18 @@ fn _allows_stmt_expr_attributes() {
189189 let one = 1 ;
190190 let two = 2 ;
191191 cfg_match ! {
192- cfg ( unix) => { one * two; }
192+ unix => { one * two; }
193193 _ => { one + two; }
194194 }
195195}
196+
197+ fn _expression ( ) {
198+ let _ = cfg_match ! ( {
199+ windows => {
200+ " XP"
201+ }
202+ _ => {
203+ ""
204+ }
205+ } ) ;
206+ }
0 commit comments