11use arbitrary:: { Arbitrary , Unstructured } ;
22use expect_test:: { expect, Expect } ;
3+ use intern:: Symbol ;
34use mbe:: { syntax_node_to_token_tree, DocCommentDesugarMode , DummyTestSpanMap , DUMMY } ;
45use syntax:: { ast, AstNode , Edition } ;
56
@@ -65,22 +66,25 @@ fn check_enable_hints(input: &str, opts: &CfgOptions, expected_hints: &[&str]) {
6566
6667#[ test]
6768fn test_cfg_expr_parser ( ) {
68- assert_parse_result ( "#![cfg(foo)]" , CfgAtom :: Flag ( "foo" . into ( ) ) . into ( ) ) ;
69- assert_parse_result ( "#![cfg(foo,)]" , CfgAtom :: Flag ( "foo" . into ( ) ) . into ( ) ) ;
69+ assert_parse_result ( "#![cfg(foo)]" , CfgAtom :: Flag ( Symbol :: intern ( "foo" ) ) . into ( ) ) ;
70+ assert_parse_result ( "#![cfg(foo,)]" , CfgAtom :: Flag ( Symbol :: intern ( "foo" ) ) . into ( ) ) ;
7071 assert_parse_result (
7172 "#![cfg(not(foo))]" ,
72- CfgExpr :: Not ( Box :: new ( CfgAtom :: Flag ( "foo" . into ( ) ) . into ( ) ) ) ,
73+ CfgExpr :: Not ( Box :: new ( CfgAtom :: Flag ( Symbol :: intern ( "foo" ) ) . into ( ) ) ) ,
7374 ) ;
7475 assert_parse_result ( "#![cfg(foo(bar))]" , CfgExpr :: Invalid ) ;
7576
7677 // Only take the first
77- assert_parse_result ( r#"#![cfg(foo, bar = "baz")]"# , CfgAtom :: Flag ( "foo" . into ( ) ) . into ( ) ) ;
78+ assert_parse_result (
79+ r#"#![cfg(foo, bar = "baz")]"# ,
80+ CfgAtom :: Flag ( Symbol :: intern ( "foo" ) ) . into ( ) ,
81+ ) ;
7882
7983 assert_parse_result (
8084 r#"#![cfg(all(foo, bar = "baz"))]"# ,
8185 CfgExpr :: All ( vec ! [
82- CfgAtom :: Flag ( "foo" . into ( ) ) . into( ) ,
83- CfgAtom :: KeyValue { key: "bar" . into ( ) , value: "baz" . into ( ) } . into( ) ,
86+ CfgAtom :: Flag ( Symbol :: intern ( "foo" ) ) . into( ) ,
87+ CfgAtom :: KeyValue { key: Symbol :: intern ( "bar" ) , value: Symbol :: intern ( "baz" ) } . into( ) ,
8488 ] ) ,
8589 ) ;
8690
@@ -90,7 +94,7 @@ fn test_cfg_expr_parser() {
9094 CfgExpr :: Not ( Box :: new( CfgExpr :: Invalid ) ) ,
9195 CfgExpr :: All ( vec![ ] ) ,
9296 CfgExpr :: Invalid ,
93- CfgAtom :: KeyValue { key: "bar" . into ( ) , value: "baz" . into ( ) } . into( ) ,
97+ CfgAtom :: KeyValue { key: Symbol :: intern ( "bar" ) , value: Symbol :: intern ( "baz" ) } . into( ) ,
9498 ] ) ,
9599 ) ;
96100}
@@ -167,7 +171,7 @@ fn hints() {
167171
168172 check_enable_hints ( "#![cfg(all(a, b))]" , & opts, & [ "enable a and b" ] ) ;
169173
170- opts. insert_atom ( "test" . into ( ) ) ;
174+ opts. insert_atom ( Symbol :: intern ( "test" ) ) ;
171175
172176 check_enable_hints ( "#![cfg(test)]" , & opts, & [ ] ) ;
173177 check_enable_hints ( "#![cfg(not(test))]" , & opts, & [ "disable test" ] ) ;
@@ -180,16 +184,16 @@ fn hints_impossible() {
180184
181185 check_enable_hints ( "#![cfg(all(test, not(test)))]" , & opts, & [ ] ) ;
182186
183- opts. insert_atom ( "test" . into ( ) ) ;
187+ opts. insert_atom ( Symbol :: intern ( "test" ) ) ;
184188
185189 check_enable_hints ( "#![cfg(all(test, not(test)))]" , & opts, & [ ] ) ;
186190}
187191
188192#[ test]
189193fn why_inactive ( ) {
190194 let mut opts = CfgOptions :: default ( ) ;
191- opts. insert_atom ( "test" . into ( ) ) ;
192- opts. insert_atom ( "test2" . into ( ) ) ;
195+ opts. insert_atom ( Symbol :: intern ( "test" ) ) ;
196+ opts. insert_atom ( Symbol :: intern ( "test2" ) ) ;
193197
194198 check_why_inactive ( "#![cfg(a)]" , & opts, expect ! [ [ "a is disabled" ] ] ) ;
195199 check_why_inactive ( "#![cfg(not(test))]" , & opts, expect ! [ [ "test is enabled" ] ] ) ;
0 commit comments