@@ -25,8 +25,8 @@ use ra_syntax::{
25
25
} ;
26
26
27
27
use crate :: {
28
- db:: HirDatabase , Adt , Const , EnumVariant , Function , Local , MacroDef , Name , Path , Static ,
29
- Struct , Trait , Type , TypeAlias , TypeParam ,
28
+ db:: HirDatabase , Adt , Const , EnumVariant , Function , Local , MacroDef , Path , Static , Struct ,
29
+ Trait , Type , TypeAlias , TypeParam ,
30
30
} ;
31
31
32
32
/// `SourceAnalyzer` is a convenience wrapper which exposes HIR API in terms of
@@ -53,22 +53,6 @@ pub enum PathResolution {
53
53
AssocItem ( crate :: AssocItem ) ,
54
54
}
55
55
56
- #[ derive( Debug , Clone , PartialEq , Eq ) ]
57
- pub struct ScopeEntryWithSyntax {
58
- pub ( crate ) name : Name ,
59
- pub ( crate ) ptr : Either < AstPtr < ast:: Pat > , AstPtr < ast:: SelfParam > > ,
60
- }
61
-
62
- impl ScopeEntryWithSyntax {
63
- pub fn name ( & self ) -> & Name {
64
- & self . name
65
- }
66
-
67
- pub fn ptr ( & self ) -> Either < AstPtr < ast:: Pat > , AstPtr < ast:: SelfParam > > {
68
- self . ptr
69
- }
70
- }
71
-
72
56
#[ derive( Debug ) ]
73
57
pub struct ReferenceDescriptor {
74
58
pub range : TextRange ,
@@ -235,16 +219,16 @@ impl SourceAnalyzer {
235
219
resolve_hir_path ( db, & self . resolver , & hir_path)
236
220
}
237
221
238
- fn resolve_local_name ( & self , name_ref : & ast:: NameRef ) -> Option < ScopeEntryWithSyntax > {
222
+ fn resolve_local_name (
223
+ & self ,
224
+ name_ref : & ast:: NameRef ,
225
+ ) -> Option < Either < AstPtr < ast:: Pat > , AstPtr < ast:: SelfParam > > > {
239
226
let name = name_ref. as_name ( ) ;
240
227
let source_map = self . body_source_map . as_ref ( ) ?;
241
228
let scopes = self . scopes . as_ref ( ) ?;
242
229
let scope = scope_for ( scopes, source_map, InFile :: new ( self . file_id , name_ref. syntax ( ) ) ) ?;
243
230
let entry = scopes. resolve_name_in_scope ( scope, & name) ?;
244
- Some ( ScopeEntryWithSyntax {
245
- name : entry. name ( ) . clone ( ) ,
246
- ptr : source_map. pat_syntax ( entry. pat ( ) ) ?. value ,
247
- } )
231
+ Some ( source_map. pat_syntax ( entry. pat ( ) ) ?. value )
248
232
}
249
233
250
234
// FIXME: we only use this in `inline_local_variable` assist, ideally, we
@@ -258,7 +242,7 @@ impl SourceAnalyzer {
258
242
. filter_map ( ast:: NameRef :: cast)
259
243
. filter ( |name_ref| match self . resolve_local_name ( & name_ref) {
260
244
None => false ,
261
- Some ( entry ) => entry . ptr ( ) == ptr,
245
+ Some ( d_ptr ) => d_ptr == ptr,
262
246
} )
263
247
. map ( |name_ref| ReferenceDescriptor {
264
248
name : name_ref. text ( ) . to_string ( ) ,
0 commit comments