@@ -11,7 +11,7 @@ use std::sync::Arc;
11
11
12
12
use ra_syntax:: {
13
13
TextRange , TextUnit , SourceFile , AstNode , SyntaxNode , TreeArc , SyntaxNodePtr ,
14
- ast:: { self , NameOwner } ,
14
+ ast,
15
15
} ;
16
16
17
17
use crate :: { MacroCallId , PersistentHirDatabase } ;
@@ -20,7 +20,6 @@ use crate::{MacroCallId, PersistentHirDatabase};
20
20
#[ derive( Debug , Clone , PartialEq , Eq ) ]
21
21
pub enum MacroDef {
22
22
Vec ,
23
- QueryGroup ,
24
23
}
25
24
26
25
impl MacroDef {
@@ -39,8 +38,6 @@ impl MacroDef {
39
38
let name_ref = path. segment ( ) ?. name_ref ( ) ?;
40
39
if name_ref. text ( ) == "vec" {
41
40
MacroDef :: Vec
42
- } else if name_ref. text ( ) == "query_group" {
43
- MacroDef :: QueryGroup
44
41
} else {
45
42
return None ;
46
43
}
@@ -56,7 +53,6 @@ impl MacroDef {
56
53
fn expand ( self , input : MacroInput ) -> Option < MacroExpansion > {
57
54
match self {
58
55
MacroDef :: Vec => self . expand_vec ( input) ,
59
- MacroDef :: QueryGroup => self . expand_query_group ( input) ,
60
56
}
61
57
}
62
58
fn expand_vec ( self , input : MacroInput ) -> Option < MacroExpansion > {
@@ -69,24 +65,6 @@ impl MacroDef {
69
65
let res = MacroExpansion { text, ranges_map, ptr } ;
70
66
Some ( res)
71
67
}
72
- fn expand_query_group ( self , input : MacroInput ) -> Option < MacroExpansion > {
73
- let anchor = "trait " ;
74
- let pos = input. text . find ( anchor) ? + anchor. len ( ) ;
75
- let trait_name =
76
- input. text [ pos..] . chars ( ) . take_while ( |c| c. is_alphabetic ( ) ) . collect :: < String > ( ) ;
77
- if trait_name. is_empty ( ) {
78
- return None ;
79
- }
80
- let src_range = TextRange :: offset_len ( ( pos as u32 ) . into ( ) , TextUnit :: of_str ( & trait_name) ) ;
81
- let text = format ! ( r"trait {} {{ }}" , trait_name) ;
82
- let file = SourceFile :: parse ( & text) ;
83
- let trait_def = file. syntax ( ) . descendants ( ) . find_map ( ast:: TraitDef :: cast) ?;
84
- let name = trait_def. name ( ) ?;
85
- let ptr = SyntaxNodePtr :: new ( trait_def. syntax ( ) ) ;
86
- let ranges_map = vec ! [ ( src_range, name. syntax( ) . range( ) ) ] ;
87
- let res = MacroExpansion { text, ranges_map, ptr } ;
88
- Some ( res)
89
- }
90
68
}
91
69
92
70
#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
@@ -109,7 +87,7 @@ pub struct MacroExpansion {
109
87
}
110
88
111
89
impl MacroExpansion {
112
- // FIXME: does not really make sense, macro expansion is not neccessary a
90
+ // FIXME: does not really make sense, macro expansion is not necessary a
113
91
// whole file. See `MacroExpansion::ptr` as well.
114
92
pub ( crate ) fn file ( & self ) -> TreeArc < SourceFile > {
115
93
SourceFile :: parse ( & self . text )
0 commit comments