@@ -47,7 +47,7 @@ pub struct MacroRefData {
47
47
48
48
impl MacroRefData {
49
49
pub fn new ( name : String , callee : Span , cx : & LateContext < ' _ > ) -> Self {
50
- let mut path = cx. sess ( ) . source_map ( ) . span_to_filename ( callee) . to_string ( ) ;
50
+ let mut path = cx. sess ( ) . source_map ( ) . span_to_filename ( callee) . prefer_local ( ) . to_string ( ) ;
51
51
52
52
// std lib paths are <::std::module::file type>
53
53
// so remove brackets, space and type.
@@ -96,8 +96,7 @@ impl MacroUseImports {
96
96
let name = snippet ( cx, cx. sess ( ) . source_map ( ) . span_until_char ( call_site, '!' ) , "_" ) ;
97
97
if let Some ( callee) = span. source_callee ( ) {
98
98
if !self . collected . contains ( & call_site) {
99
- self . mac_refs
100
- . push ( MacroRefData :: new ( name. to_string ( ) , callee. def_site , cx) ) ;
99
+ self . mac_refs . push ( MacroRefData :: new ( name. to_string ( ) , callee. def_site , cx) ) ;
101
100
self . collected . insert ( call_site) ;
102
101
}
103
102
}
@@ -175,7 +174,7 @@ impl<'tcx> LateLintPass<'tcx> for MacroUseImports {
175
174
. push ( ( * item) . to_string ( ) ) ;
176
175
check_dup. push ( ( * item) . to_string ( ) ) ;
177
176
}
178
- } ,
177
+ }
179
178
[ root, rest @ ..] => {
180
179
if rest. iter ( ) . all ( |item| !check_dup. contains ( & ( * item) . to_string ( ) ) ) {
181
180
let filtered = rest
@@ -199,7 +198,7 @@ impl<'tcx> LateLintPass<'tcx> for MacroUseImports {
199
198
. push ( rest. join ( "::" ) ) ;
200
199
check_dup. extend ( rest. iter ( ) . map ( ToString :: to_string) ) ;
201
200
}
202
- } ,
201
+ }
203
202
}
204
203
}
205
204
}
0 commit comments