File tree 4 files changed +6
-12
lines changed
4 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,6 @@ bytecount = "0.6"
78
78
dunce = " 1.0"
79
79
ignore = " 0.4.11"
80
80
itertools = " 0.8"
81
- lazy_static = " 1.0.0"
82
81
log = " 0.4"
83
82
regex = " 1.0"
84
83
thiserror = " 1.0"
@@ -104,6 +103,7 @@ toml = { version = "0.5", optional = true }
104
103
105
104
[dev-dependencies ]
106
105
env_logger = " 0.7"
106
+ lazy_static = " 1.0.0"
107
107
108
108
[dependencies .rustc_ast ]
109
109
package = " rustc-ap-rustc_ast"
Original file line number Diff line number Diff line change @@ -21,10 +21,6 @@ mod visitor;
21
21
22
22
type FileModMap < ' ast > = BTreeMap < FileName , Module < ' ast > > ;
23
23
24
- lazy_static ! {
25
- static ref CFG_IF : Symbol = Symbol :: intern( "cfg_if" ) ;
26
- }
27
-
28
24
/// Represents module with its inner attributes.
29
25
#[ derive( Debug , Clone ) ]
30
26
pub ( crate ) struct Module < ' a > {
@@ -479,8 +475,8 @@ fn find_path_value(attrs: &[ast::Attribute]) -> Option<Symbol> {
479
475
fn is_cfg_if ( item : & ast:: Item ) -> bool {
480
476
match item. kind {
481
477
ast:: ItemKind :: MacCall ( ref mac) => {
482
- if let Some ( first_segment ) = mac. path . segments . first ( ) {
483
- if first_segment . ident . name == * CFG_IF {
478
+ if let Some ( last_segment ) = mac. path . segments . last ( ) {
479
+ if last_segment . ident . name . as_str ( ) == "cfg_if" {
484
480
return true ;
485
481
}
486
482
}
Original file line number Diff line number Diff line change @@ -49,9 +49,9 @@ impl<'a, 'ast: 'a> CfgIfVisitor<'a> {
49
49
// extern crate cfg_if;
50
50
// cfg_if! {..}
51
51
// ```
52
- match mac. path . segments . first ( ) {
53
- Some ( first_segment ) => {
54
- if first_segment . ident . name != Symbol :: intern ( "cfg_if" ) {
52
+ match mac. path . segments . last ( ) {
53
+ Some ( last_segment ) => {
54
+ if last_segment . ident . name != Symbol :: intern ( "cfg_if" ) {
55
55
return Err ( "Expected cfg_if" ) ;
56
56
}
57
57
}
Original file line number Diff line number Diff line change 2
2
#![ warn( unreachable_pub) ]
3
3
#![ feature( cell_leak) ]
4
4
5
- #[ macro_use]
6
- extern crate lazy_static;
7
5
#[ macro_use]
8
6
extern crate log;
9
7
You can’t perform that action at this time.
0 commit comments