@@ -121,7 +121,7 @@ impl CallInfo {
121
121
node. syntax ( ) . text ( ) . to_string ( )
122
122
} ;
123
123
124
- if let Some ( ( comment_range, docs) ) = CallInfo :: extract_doc_comments ( node) {
124
+ if let Some ( ( comment_range, docs) ) = extract_doc_comments ( node) {
125
125
let comment_range = comment_range
126
126
. checked_sub ( node. syntax ( ) . range ( ) . start ( ) )
127
127
. unwrap ( ) ;
@@ -154,51 +154,51 @@ impl CallInfo {
154
154
}
155
155
156
156
Some ( CallInfo {
157
- parameters : CallInfo :: param_list ( node) ,
157
+ parameters : param_list ( node) ,
158
158
label : label. trim ( ) . to_owned ( ) ,
159
159
doc,
160
160
active_parameter : None ,
161
161
} )
162
162
}
163
+ }
163
164
164
- fn extract_doc_comments ( node : & ast:: FnDef ) -> Option < ( TextRange , String ) > {
165
- if node. doc_comments ( ) . count ( ) == 0 {
166
- return None ;
167
- }
168
-
169
- let comment_text = node. doc_comment_text ( ) ;
165
+ fn extract_doc_comments ( node : & ast:: FnDef ) -> Option < ( TextRange , String ) > {
166
+ if node. doc_comments ( ) . count ( ) == 0 {
167
+ return None ;
168
+ }
170
169
171
- let ( begin, end) = node
172
- . doc_comments ( )
173
- . map ( |comment| comment. syntax ( ) . range ( ) )
174
- . map ( |range| ( range. start ( ) . to_usize ( ) , range. end ( ) . to_usize ( ) ) )
175
- . fold ( ( std:: usize:: MAX , std:: usize:: MIN ) , |acc, range| {
176
- ( min ( acc. 0 , range. 0 ) , max ( acc. 1 , range. 1 ) )
177
- } ) ;
170
+ let comment_text = node. doc_comment_text ( ) ;
178
171
179
- let range = TextRange :: from_to ( TextUnit :: from_usize ( begin) , TextUnit :: from_usize ( end) ) ;
172
+ let ( begin, end) = node
173
+ . doc_comments ( )
174
+ . map ( |comment| comment. syntax ( ) . range ( ) )
175
+ . map ( |range| ( range. start ( ) . to_usize ( ) , range. end ( ) . to_usize ( ) ) )
176
+ . fold ( ( std:: usize:: MAX , std:: usize:: MIN ) , |acc, range| {
177
+ ( min ( acc. 0 , range. 0 ) , max ( acc. 1 , range. 1 ) )
178
+ } ) ;
180
179
181
- Some ( ( range, comment_text) )
182
- }
180
+ let range = TextRange :: from_to ( TextUnit :: from_usize ( begin) , TextUnit :: from_usize ( end) ) ;
183
181
184
- fn param_list ( node : & ast:: FnDef ) -> Vec < String > {
185
- let mut res = vec ! [ ] ;
186
- if let Some ( param_list) = node. param_list ( ) {
187
- if let Some ( self_param) = param_list. self_param ( ) {
188
- res. push ( self_param. syntax ( ) . text ( ) . to_string ( ) )
189
- }
182
+ Some ( ( range, comment_text) )
183
+ }
190
184
191
- // Maybe use param.pat here? See if we can just extract the name?
192
- //res.extend(param_list.params().map(|p| p.syntax().text().to_string()));
193
- res. extend (
194
- param_list
195
- . params ( )
196
- . filter_map ( |p| p. pat ( ) )
197
- . map ( |pat| pat. syntax ( ) . text ( ) . to_string ( ) ) ,
198
- ) ;
185
+ fn param_list ( node : & ast:: FnDef ) -> Vec < String > {
186
+ let mut res = vec ! [ ] ;
187
+ if let Some ( param_list) = node. param_list ( ) {
188
+ if let Some ( self_param) = param_list. self_param ( ) {
189
+ res. push ( self_param. syntax ( ) . text ( ) . to_string ( ) )
199
190
}
200
- res
191
+
192
+ // Maybe use param.pat here? See if we can just extract the name?
193
+ //res.extend(param_list.params().map(|p| p.syntax().text().to_string()));
194
+ res. extend (
195
+ param_list
196
+ . params ( )
197
+ . filter_map ( |p| p. pat ( ) )
198
+ . map ( |pat| pat. syntax ( ) . text ( ) . to_string ( ) ) ,
199
+ ) ;
201
200
}
201
+ res
202
202
}
203
203
204
204
#[ cfg( test) ]
0 commit comments