diff options
Diffstat (limited to 'crates/ra_analysis/src/descriptors.rs')
-rw-r--r-- | crates/ra_analysis/src/descriptors.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_analysis/src/descriptors.rs b/crates/ra_analysis/src/descriptors.rs index 4dcac1aa2..faf945a41 100644 --- a/crates/ra_analysis/src/descriptors.rs +++ b/crates/ra_analysis/src/descriptors.rs | |||
@@ -4,7 +4,7 @@ use std::{ | |||
4 | use relative_path::RelativePathBuf; | 4 | use relative_path::RelativePathBuf; |
5 | use ra_syntax::{ | 5 | use ra_syntax::{ |
6 | SmolStr, | 6 | SmolStr, |
7 | ast::{self, NameOwner, AstNode, TypeParamsOwner}, | 7 | ast::{self, NameOwner, AstNode}, |
8 | text_utils::is_subrange | 8 | text_utils::is_subrange |
9 | }; | 9 | }; |
10 | use { | 10 | use { |
@@ -222,15 +222,15 @@ fn resolve_submodule( | |||
222 | 222 | ||
223 | #[derive(Debug, Clone)] | 223 | #[derive(Debug, Clone)] |
224 | pub struct FnDescriptor { | 224 | pub struct FnDescriptor { |
225 | pub name: Option<String>, | 225 | pub name: String, |
226 | pub label : String, | 226 | pub label : String, |
227 | pub ret_type: Option<String>, | 227 | pub ret_type: Option<String>, |
228 | pub params: Vec<String>, | 228 | pub params: Vec<String>, |
229 | } | 229 | } |
230 | 230 | ||
231 | impl FnDescriptor { | 231 | impl FnDescriptor { |
232 | pub fn new(node: ast::FnDef) -> Self { | 232 | pub fn new(node: ast::FnDef) -> Option<Self> { |
233 | let name = node.name().map(|name| name.text().to_string()); | 233 | let name = node.name()?.text().to_string(); |
234 | 234 | ||
235 | // Strip the body out for the label. | 235 | // Strip the body out for the label. |
236 | let label : String = if let Some(body) = node.body() { | 236 | let label : String = if let Some(body) = node.body() { |
@@ -247,12 +247,12 @@ impl FnDescriptor { | |||
247 | let params = FnDescriptor::param_list(node); | 247 | let params = FnDescriptor::param_list(node); |
248 | let ret_type = node.ret_type().map(|r| r.syntax().text().to_string()); | 248 | let ret_type = node.ret_type().map(|r| r.syntax().text().to_string()); |
249 | 249 | ||
250 | FnDescriptor { | 250 | Some(FnDescriptor { |
251 | name, | 251 | name, |
252 | ret_type, | 252 | ret_type, |
253 | params, | 253 | params, |
254 | label | 254 | label |
255 | } | 255 | }) |
256 | } | 256 | } |
257 | 257 | ||
258 | fn param_list(node: ast::FnDef) -> Vec<String> { | 258 | fn param_list(node: ast::FnDef) -> Vec<String> { |