@@ -63,7 +63,7 @@ use dump_visitor::DumpVisitor;
63
63
use span_utils:: SpanUtils ;
64
64
65
65
use rls_data:: { Ref , RefKind , SpanData , MacroRef , Def , DefKind , Relation , RelationKind ,
66
- ExternalCrateData } ;
66
+ ExternalCrateData , GlobalCrateId } ;
67
67
use rls_data:: config:: Config ;
68
68
69
69
@@ -82,10 +82,6 @@ pub enum Data {
82
82
RelationData ( Relation ) ,
83
83
}
84
84
85
- macro_rules! option_try(
86
- ( $e: expr) => ( match $e { Some ( e) => e, None => return None } )
87
- ) ;
88
-
89
85
impl < ' l , ' tcx : ' l > SaveContext < ' l , ' tcx > {
90
86
fn span_from_span ( & self , span : Span ) -> SpanData {
91
87
use rls_span:: { Row , Column } ;
@@ -119,9 +115,12 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
119
115
} ;
120
116
let lo_loc = self . span_utils . sess . codemap ( ) . lookup_char_pos ( span. lo ( ) ) ;
121
117
result. push ( ExternalCrateData {
122
- name : self . tcx . crate_name ( n) . to_string ( ) ,
123
- num : n. as_u32 ( ) ,
124
118
file_name : SpanUtils :: make_path_string ( & lo_loc. file . name ) ,
119
+ num : n. as_u32 ( ) ,
120
+ id : GlobalCrateId {
121
+ name : self . tcx . crate_name ( n) . to_string ( ) ,
122
+ disambiguator : self . tcx . crate_disambiguator ( n) . to_string ( ) ,
123
+ } ,
125
124
} ) ;
126
125
}
127
126
@@ -725,8 +724,8 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
725
724
// macro uses.
726
725
let callsite = span. source_callsite ( ) ;
727
726
let callsite_span = self . span_from_span ( callsite) ;
728
- let callee = option_try ! ( span. source_callee( ) ) ;
729
- let callee_span = option_try ! ( callee. span) ;
727
+ let callee = span. source_callee ( ) ? ;
728
+ let callee_span = callee. span ? ;
730
729
731
730
// Ignore attribute macros, their spans are usually mangled
732
731
if let MacroAttribute ( _) = callee. format {
0 commit comments