diff options
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_dot.rs | 6 | ||||
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_path.rs | 8 | ||||
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_scope.rs | 6 | ||||
-rw-r--r-- | crates/ra_ide_api/src/completion/completion_item.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/src/goto_definition.rs | 12 | ||||
-rw-r--r-- | crates/ra_ide_api/src/hover.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/src/imp.rs | 14 | ||||
-rw-r--r-- | crates/ra_ide_api/src/lib.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/src/navigation_target.rs | 56 | ||||
-rw-r--r-- | crates/ra_ide_api/src/parent_module.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/src/runnables.rs | 4 |
11 files changed, 50 insertions, 64 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_dot.rs b/crates/ra_ide_api/src/completion/complete_dot.rs index 37985b398..cb86ba9a3 100644 --- a/crates/ra_ide_api/src/completion/complete_dot.rs +++ b/crates/ra_ide_api/src/completion/complete_dot.rs | |||
@@ -10,7 +10,7 @@ pub(super) fn complete_dot(acc: &mut Completions, ctx: &CompletionContext) -> Ca | |||
10 | _ => return Ok(()), | 10 | _ => return Ok(()), |
11 | }; | 11 | }; |
12 | let infer_result = function.infer(ctx.db)?; | 12 | let infer_result = function.infer(ctx.db)?; |
13 | let syntax_mapping = function.body_syntax_mapping(ctx.db)?; | 13 | let syntax_mapping = function.body_syntax_mapping(ctx.db); |
14 | let expr = match syntax_mapping.node_expr(receiver) { | 14 | let expr = match syntax_mapping.node_expr(receiver) { |
15 | Some(expr) => expr, | 15 | Some(expr) => expr, |
16 | None => return Ok(()), | 16 | None => return Ok(()), |
@@ -27,9 +27,9 @@ fn complete_fields(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty) | |||
27 | for receiver in receiver.autoderef(ctx.db) { | 27 | for receiver in receiver.autoderef(ctx.db) { |
28 | match receiver { | 28 | match receiver { |
29 | Ty::Adt { def_id, .. } => { | 29 | Ty::Adt { def_id, .. } => { |
30 | match def_id.resolve(ctx.db)? { | 30 | match def_id.resolve(ctx.db) { |
31 | Def::Struct(s) => { | 31 | Def::Struct(s) => { |
32 | for field in s.fields(ctx.db)? { | 32 | for field in s.fields(ctx.db) { |
33 | CompletionItem::new( | 33 | CompletionItem::new( |
34 | CompletionKind::Reference, | 34 | CompletionKind::Reference, |
35 | field.name().to_string(), | 35 | field.name().to_string(), |
diff --git a/crates/ra_ide_api/src/completion/complete_path.rs b/crates/ra_ide_api/src/completion/complete_path.rs index a25ad3f13..42468681a 100644 --- a/crates/ra_ide_api/src/completion/complete_path.rs +++ b/crates/ra_ide_api/src/completion/complete_path.rs | |||
@@ -8,13 +8,13 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) -> C | |||
8 | (Some(path), Some(module)) => (path.clone(), module), | 8 | (Some(path), Some(module)) => (path.clone(), module), |
9 | _ => return Ok(()), | 9 | _ => return Ok(()), |
10 | }; | 10 | }; |
11 | let def_id = match module.resolve_path(ctx.db, &path)?.take_types() { | 11 | let def_id = match module.resolve_path(ctx.db, &path).take_types() { |
12 | Some(it) => it, | 12 | Some(it) => it, |
13 | None => return Ok(()), | 13 | None => return Ok(()), |
14 | }; | 14 | }; |
15 | match def_id.resolve(ctx.db)? { | 15 | match def_id.resolve(ctx.db) { |
16 | hir::Def::Module(module) => { | 16 | hir::Def::Module(module) => { |
17 | let module_scope = module.scope(ctx.db)?; | 17 | let module_scope = module.scope(ctx.db); |
18 | for (name, res) in module_scope.entries() { | 18 | for (name, res) in module_scope.entries() { |
19 | CompletionItem::new(CompletionKind::Reference, name.to_string()) | 19 | CompletionItem::new(CompletionKind::Reference, name.to_string()) |
20 | .from_resolution(ctx, res) | 20 | .from_resolution(ctx, res) |
@@ -22,7 +22,7 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) -> C | |||
22 | } | 22 | } |
23 | } | 23 | } |
24 | hir::Def::Enum(e) => { | 24 | hir::Def::Enum(e) => { |
25 | e.variants(ctx.db)? | 25 | e.variants(ctx.db) |
26 | .into_iter() | 26 | .into_iter() |
27 | .for_each(|(variant_name, _variant)| { | 27 | .for_each(|(variant_name, _variant)| { |
28 | CompletionItem::new(CompletionKind::Reference, variant_name.to_string()) | 28 | CompletionItem::new(CompletionKind::Reference, variant_name.to_string()) |
diff --git a/crates/ra_ide_api/src/completion/complete_scope.rs b/crates/ra_ide_api/src/completion/complete_scope.rs index 770a0fdf2..660c7d16e 100644 --- a/crates/ra_ide_api/src/completion/complete_scope.rs +++ b/crates/ra_ide_api/src/completion/complete_scope.rs | |||
@@ -15,12 +15,12 @@ pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) -> | |||
15 | None => return Ok(()), | 15 | None => return Ok(()), |
16 | }; | 16 | }; |
17 | if let Some(function) = &ctx.function { | 17 | if let Some(function) = &ctx.function { |
18 | let scopes = function.scopes(ctx.db)?; | 18 | let scopes = function.scopes(ctx.db); |
19 | complete_fn(acc, &scopes, ctx.offset); | 19 | complete_fn(acc, &scopes, ctx.offset); |
20 | } | 20 | } |
21 | 21 | ||
22 | let module_scope = module.scope(ctx.db)?; | 22 | let module_scope = module.scope(ctx.db); |
23 | let (file_id, _) = module.definition_source(ctx.db)?; | 23 | let (file_id, _) = module.definition_source(ctx.db); |
24 | module_scope | 24 | module_scope |
25 | .entries() | 25 | .entries() |
26 | .filter(|(_name, res)| { | 26 | .filter(|(_name, res)| { |
diff --git a/crates/ra_ide_api/src/completion/completion_item.rs b/crates/ra_ide_api/src/completion/completion_item.rs index b75d65de3..11d00f78c 100644 --- a/crates/ra_ide_api/src/completion/completion_item.rs +++ b/crates/ra_ide_api/src/completion/completion_item.rs | |||
@@ -144,7 +144,7 @@ impl Builder { | |||
144 | ctx: &CompletionContext, | 144 | ctx: &CompletionContext, |
145 | resolution: &hir::Resolution, | 145 | resolution: &hir::Resolution, |
146 | ) -> Builder { | 146 | ) -> Builder { |
147 | let resolved = resolution.def_id.and_then(|d| d.resolve(ctx.db).ok()); | 147 | let resolved = resolution.def_id.map(|d| d.resolve(ctx.db)); |
148 | let kind = match resolved { | 148 | let kind = match resolved { |
149 | PerNs { | 149 | PerNs { |
150 | types: Some(hir::Def::Module(..)), | 150 | types: Some(hir::Def::Module(..)), |
diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs index 591f36cce..cdd8e211d 100644 --- a/crates/ra_ide_api/src/goto_definition.rs +++ b/crates/ra_ide_api/src/goto_definition.rs | |||
@@ -50,7 +50,7 @@ pub(crate) fn reference_definition( | |||
50 | if let Some(function) = | 50 | if let Some(function) = |
51 | hir::source_binder::function_from_child_node(db, file_id, name_ref.syntax()) | 51 | hir::source_binder::function_from_child_node(db, file_id, name_ref.syntax()) |
52 | { | 52 | { |
53 | let scope = function.scopes(db)?; | 53 | let scope = function.scopes(db); |
54 | // First try to resolve the symbol locally | 54 | // First try to resolve the symbol locally |
55 | if let Some(entry) = scope.resolve_local_name(name_ref) { | 55 | if let Some(entry) = scope.resolve_local_name(name_ref) { |
56 | let nav = NavigationTarget::from_scope_entry(file_id, &entry); | 56 | let nav = NavigationTarget::from_scope_entry(file_id, &entry); |
@@ -64,13 +64,13 @@ pub(crate) fn reference_definition( | |||
64 | .and_then(ast::MethodCallExpr::cast) | 64 | .and_then(ast::MethodCallExpr::cast) |
65 | { | 65 | { |
66 | let infer_result = function.infer(db)?; | 66 | let infer_result = function.infer(db)?; |
67 | let syntax_mapping = function.body_syntax_mapping(db)?; | 67 | let syntax_mapping = function.body_syntax_mapping(db); |
68 | let expr = ast::Expr::cast(method_call.syntax()).unwrap(); | 68 | let expr = ast::Expr::cast(method_call.syntax()).unwrap(); |
69 | if let Some(def_id) = syntax_mapping | 69 | if let Some(def_id) = syntax_mapping |
70 | .node_expr(expr) | 70 | .node_expr(expr) |
71 | .and_then(|it| infer_result.method_resolution(it)) | 71 | .and_then(|it| infer_result.method_resolution(it)) |
72 | { | 72 | { |
73 | if let Some(target) = NavigationTarget::from_def(db, def_id.resolve(db)?)? { | 73 | if let Some(target) = NavigationTarget::from_def(db, def_id.resolve(db)) { |
74 | return Ok(Exact(target)); | 74 | return Ok(Exact(target)); |
75 | } | 75 | } |
76 | }; | 76 | }; |
@@ -85,9 +85,9 @@ pub(crate) fn reference_definition( | |||
85 | .find_map(ast::Path::cast) | 85 | .find_map(ast::Path::cast) |
86 | .and_then(hir::Path::from_ast) | 86 | .and_then(hir::Path::from_ast) |
87 | { | 87 | { |
88 | let resolved = module.resolve_path(db, &path)?; | 88 | let resolved = module.resolve_path(db, &path); |
89 | if let Some(def_id) = resolved.take_types().or(resolved.take_values()) { | 89 | if let Some(def_id) = resolved.take_types().or(resolved.take_values()) { |
90 | if let Some(target) = NavigationTarget::from_def(db, def_id.resolve(db)?)? { | 90 | if let Some(target) = NavigationTarget::from_def(db, def_id.resolve(db)) { |
91 | return Ok(Exact(target)); | 91 | return Ok(Exact(target)); |
92 | } | 92 | } |
93 | } | 93 | } |
@@ -112,7 +112,7 @@ fn name_definition( | |||
112 | if let Some(child_module) = | 112 | if let Some(child_module) = |
113 | hir::source_binder::module_from_declaration(db, file_id, module) | 113 | hir::source_binder::module_from_declaration(db, file_id, module) |
114 | { | 114 | { |
115 | let nav = NavigationTarget::from_module(db, child_module)?; | 115 | let nav = NavigationTarget::from_module(db, child_module); |
116 | return Ok(Some(vec![nav])); | 116 | return Ok(Some(vec![nav])); |
117 | } | 117 | } |
118 | } | 118 | } |
diff --git a/crates/ra_ide_api/src/hover.rs b/crates/ra_ide_api/src/hover.rs index 26f3ced70..0e9c48421 100644 --- a/crates/ra_ide_api/src/hover.rs +++ b/crates/ra_ide_api/src/hover.rs | |||
@@ -74,7 +74,7 @@ pub(crate) fn type_of(db: &RootDatabase, frange: FileRange) -> Cancelable<Option | |||
74 | parent_fn | 74 | parent_fn |
75 | )); | 75 | )); |
76 | let infer = function.infer(db)?; | 76 | let infer = function.infer(db)?; |
77 | let syntax_mapping = function.body_syntax_mapping(db)?; | 77 | let syntax_mapping = function.body_syntax_mapping(db); |
78 | if let Some(expr) = ast::Expr::cast(node).and_then(|e| syntax_mapping.node_expr(e)) { | 78 | if let Some(expr) = ast::Expr::cast(node).and_then(|e| syntax_mapping.node_expr(e)) { |
79 | Ok(Some(infer[expr].to_string())) | 79 | Ok(Some(infer[expr].to_string())) |
80 | } else if let Some(pat) = ast::Pat::cast(node).and_then(|p| syntax_mapping.node_pat(p)) { | 80 | } else if let Some(pat) = ast::Pat::cast(node).and_then(|p| syntax_mapping.node_pat(p)) { |
diff --git a/crates/ra_ide_api/src/imp.rs b/crates/ra_ide_api/src/imp.rs index 76cb312dd..8b2cd6e27 100644 --- a/crates/ra_ide_api/src/imp.rs +++ b/crates/ra_ide_api/src/imp.rs | |||
@@ -99,16 +99,16 @@ impl db::RootDatabase { | |||
99 | 99 | ||
100 | impl db::RootDatabase { | 100 | impl db::RootDatabase { |
101 | /// Returns `Vec` for the same reason as `parent_module` | 101 | /// Returns `Vec` for the same reason as `parent_module` |
102 | pub(crate) fn crate_for(&self, file_id: FileId) -> Cancelable<Vec<CrateId>> { | 102 | pub(crate) fn crate_for(&self, file_id: FileId) -> Vec<CrateId> { |
103 | let module = match source_binder::module_from_file_id(self, file_id) { | 103 | let module = match source_binder::module_from_file_id(self, file_id) { |
104 | Some(it) => it, | 104 | Some(it) => it, |
105 | None => return Ok(Vec::new()), | 105 | None => return Vec::new(), |
106 | }; | 106 | }; |
107 | let krate = match module.krate(self)? { | 107 | let krate = match module.krate(self) { |
108 | Some(it) => it, | 108 | Some(it) => it, |
109 | None => return Ok(Vec::new()), | 109 | None => return Vec::new(), |
110 | }; | 110 | }; |
111 | Ok(vec![krate.crate_id()]) | 111 | vec![krate.crate_id()] |
112 | } | 112 | } |
113 | pub(crate) fn find_all_refs( | 113 | pub(crate) fn find_all_refs( |
114 | &self, | 114 | &self, |
@@ -128,7 +128,7 @@ impl db::RootDatabase { | |||
128 | .collect::<Vec<_>>(); | 128 | .collect::<Vec<_>>(); |
129 | ret.extend( | 129 | ret.extend( |
130 | descr | 130 | descr |
131 | .scopes(self)? | 131 | .scopes(self) |
132 | .find_all_refs(binding) | 132 | .find_all_refs(binding) |
133 | .into_iter() | 133 | .into_iter() |
134 | .map(|ref_desc| (position.file_id, ref_desc.range)), | 134 | .map(|ref_desc| (position.file_id, ref_desc.range)), |
@@ -156,7 +156,7 @@ impl db::RootDatabase { | |||
156 | position.file_id, | 156 | position.file_id, |
157 | name_ref.syntax(), | 157 | name_ref.syntax(), |
158 | )); | 158 | )); |
159 | let scope = descr.scopes(db)?; | 159 | let scope = descr.scopes(db); |
160 | let resolved = ctry!(scope.resolve_local_name(name_ref)); | 160 | let resolved = ctry!(scope.resolve_local_name(name_ref)); |
161 | let resolved = resolved.ptr().resolve(source_file); | 161 | let resolved = resolved.ptr().resolve(source_file); |
162 | let binding = ctry!(find_node_at_offset::<ast::BindPat>( | 162 | let binding = ctry!(find_node_at_offset::<ast::BindPat>( |
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs index e0b8410d1..0f690fc84 100644 --- a/crates/ra_ide_api/src/lib.rs +++ b/crates/ra_ide_api/src/lib.rs | |||
@@ -419,7 +419,7 @@ impl Analysis { | |||
419 | 419 | ||
420 | /// Returns crates this file belongs too. | 420 | /// Returns crates this file belongs too. |
421 | pub fn crate_for(&self, file_id: FileId) -> Cancelable<Vec<CrateId>> { | 421 | pub fn crate_for(&self, file_id: FileId) -> Cancelable<Vec<CrateId>> { |
422 | self.with_db(|db| db.crate_for(file_id))? | 422 | self.with_db(|db| db.crate_for(file_id)) |
423 | } | 423 | } |
424 | 424 | ||
425 | /// Returns the root file of the given crate. | 425 | /// Returns the root file of the given crate. |
diff --git a/crates/ra_ide_api/src/navigation_target.rs b/crates/ra_ide_api/src/navigation_target.rs index 230d0f67a..21c15c0c0 100644 --- a/crates/ra_ide_api/src/navigation_target.rs +++ b/crates/ra_ide_api/src/navigation_target.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use ra_db::{FileId, Cancelable}; | 1 | use ra_db::FileId; |
2 | use ra_syntax::{ | 2 | use ra_syntax::{ |
3 | SyntaxNode, AstNode, SmolStr, TextRange, ast, | 3 | SyntaxNode, AstNode, SmolStr, TextRange, ast, |
4 | SyntaxKind::{self, NAME}, | 4 | SyntaxKind::{self, NAME}, |
@@ -69,84 +69,72 @@ impl NavigationTarget { | |||
69 | } | 69 | } |
70 | } | 70 | } |
71 | 71 | ||
72 | pub(crate) fn from_module( | 72 | pub(crate) fn from_module(db: &RootDatabase, module: hir::Module) -> NavigationTarget { |
73 | db: &RootDatabase, | 73 | let (file_id, source) = module.definition_source(db); |
74 | module: hir::Module, | ||
75 | ) -> Cancelable<NavigationTarget> { | ||
76 | let (file_id, source) = module.definition_source(db)?; | ||
77 | let name = module | 74 | let name = module |
78 | .name(db)? | 75 | .name(db) |
79 | .map(|it| it.to_string().into()) | 76 | .map(|it| it.to_string().into()) |
80 | .unwrap_or_default(); | 77 | .unwrap_or_default(); |
81 | let res = match source { | 78 | match source { |
82 | ModuleSource::SourceFile(node) => { | 79 | ModuleSource::SourceFile(node) => { |
83 | NavigationTarget::from_syntax(file_id, name, None, node.syntax()) | 80 | NavigationTarget::from_syntax(file_id, name, None, node.syntax()) |
84 | } | 81 | } |
85 | ModuleSource::Module(node) => { | 82 | ModuleSource::Module(node) => { |
86 | NavigationTarget::from_syntax(file_id, name, None, node.syntax()) | 83 | NavigationTarget::from_syntax(file_id, name, None, node.syntax()) |
87 | } | 84 | } |
88 | }; | 85 | } |
89 | Ok(res) | ||
90 | } | 86 | } |
91 | 87 | ||
92 | pub(crate) fn from_module_to_decl( | 88 | pub(crate) fn from_module_to_decl(db: &RootDatabase, module: hir::Module) -> NavigationTarget { |
93 | db: &RootDatabase, | ||
94 | module: hir::Module, | ||
95 | ) -> Cancelable<NavigationTarget> { | ||
96 | let name = module | 89 | let name = module |
97 | .name(db)? | 90 | .name(db) |
98 | .map(|it| it.to_string().into()) | 91 | .map(|it| it.to_string().into()) |
99 | .unwrap_or_default(); | 92 | .unwrap_or_default(); |
100 | if let Some((file_id, source)) = module.declaration_source(db)? { | 93 | if let Some((file_id, source)) = module.declaration_source(db) { |
101 | return Ok(NavigationTarget::from_syntax( | 94 | return NavigationTarget::from_syntax(file_id, name, None, source.syntax()); |
102 | file_id, | ||
103 | name, | ||
104 | None, | ||
105 | source.syntax(), | ||
106 | )); | ||
107 | } | 95 | } |
108 | NavigationTarget::from_module(db, module) | 96 | NavigationTarget::from_module(db, module) |
109 | } | 97 | } |
110 | 98 | ||
111 | // TODO once Def::Item is gone, this should be able to always return a NavigationTarget | 99 | // TODO once Def::Item is gone, this should be able to always return a NavigationTarget |
112 | pub(crate) fn from_def(db: &RootDatabase, def: Def) -> Cancelable<Option<NavigationTarget>> { | 100 | pub(crate) fn from_def(db: &RootDatabase, def: Def) -> Option<NavigationTarget> { |
113 | let res = match def { | 101 | let res = match def { |
114 | Def::Struct(s) => { | 102 | Def::Struct(s) => { |
115 | let (file_id, node) = s.source(db)?; | 103 | let (file_id, node) = s.source(db); |
116 | NavigationTarget::from_named(file_id.original_file(db), &*node) | 104 | NavigationTarget::from_named(file_id.original_file(db), &*node) |
117 | } | 105 | } |
118 | Def::Enum(e) => { | 106 | Def::Enum(e) => { |
119 | let (file_id, node) = e.source(db)?; | 107 | let (file_id, node) = e.source(db); |
120 | NavigationTarget::from_named(file_id.original_file(db), &*node) | 108 | NavigationTarget::from_named(file_id.original_file(db), &*node) |
121 | } | 109 | } |
122 | Def::EnumVariant(ev) => { | 110 | Def::EnumVariant(ev) => { |
123 | let (file_id, node) = ev.source(db)?; | 111 | let (file_id, node) = ev.source(db); |
124 | NavigationTarget::from_named(file_id.original_file(db), &*node) | 112 | NavigationTarget::from_named(file_id.original_file(db), &*node) |
125 | } | 113 | } |
126 | Def::Function(f) => { | 114 | Def::Function(f) => { |
127 | let (file_id, node) = f.source(db)?; | 115 | let (file_id, node) = f.source(db); |
128 | NavigationTarget::from_named(file_id.original_file(db), &*node) | 116 | NavigationTarget::from_named(file_id.original_file(db), &*node) |
129 | } | 117 | } |
130 | Def::Trait(f) => { | 118 | Def::Trait(f) => { |
131 | let (file_id, node) = f.source(db)?; | 119 | let (file_id, node) = f.source(db); |
132 | NavigationTarget::from_named(file_id.original_file(db), &*node) | 120 | NavigationTarget::from_named(file_id.original_file(db), &*node) |
133 | } | 121 | } |
134 | Def::Type(f) => { | 122 | Def::Type(f) => { |
135 | let (file_id, node) = f.source(db)?; | 123 | let (file_id, node) = f.source(db); |
136 | NavigationTarget::from_named(file_id.original_file(db), &*node) | 124 | NavigationTarget::from_named(file_id.original_file(db), &*node) |
137 | } | 125 | } |
138 | Def::Static(f) => { | 126 | Def::Static(f) => { |
139 | let (file_id, node) = f.source(db)?; | 127 | let (file_id, node) = f.source(db); |
140 | NavigationTarget::from_named(file_id.original_file(db), &*node) | 128 | NavigationTarget::from_named(file_id.original_file(db), &*node) |
141 | } | 129 | } |
142 | Def::Const(f) => { | 130 | Def::Const(f) => { |
143 | let (file_id, node) = f.source(db)?; | 131 | let (file_id, node) = f.source(db); |
144 | NavigationTarget::from_named(file_id.original_file(db), &*node) | 132 | NavigationTarget::from_named(file_id.original_file(db), &*node) |
145 | } | 133 | } |
146 | Def::Module(m) => NavigationTarget::from_module(db, m)?, | 134 | Def::Module(m) => NavigationTarget::from_module(db, m), |
147 | Def::Item => return Ok(None), | 135 | Def::Item => return None, |
148 | }; | 136 | }; |
149 | Ok(Some(res)) | 137 | Some(res) |
150 | } | 138 | } |
151 | 139 | ||
152 | #[cfg(test)] | 140 | #[cfg(test)] |
diff --git a/crates/ra_ide_api/src/parent_module.rs b/crates/ra_ide_api/src/parent_module.rs index 451304739..379b3f3a4 100644 --- a/crates/ra_ide_api/src/parent_module.rs +++ b/crates/ra_ide_api/src/parent_module.rs | |||
@@ -12,7 +12,7 @@ pub(crate) fn parent_module( | |||
12 | None => return Ok(Vec::new()), | 12 | None => return Ok(Vec::new()), |
13 | Some(it) => it, | 13 | Some(it) => it, |
14 | }; | 14 | }; |
15 | let nav = NavigationTarget::from_module_to_decl(db, module)?; | 15 | let nav = NavigationTarget::from_module_to_decl(db, module); |
16 | Ok(vec![nav]) | 16 | Ok(vec![nav]) |
17 | } | 17 | } |
18 | 18 | ||
diff --git a/crates/ra_ide_api/src/runnables.rs b/crates/ra_ide_api/src/runnables.rs index 9fa0f79a6..a3207fdd2 100644 --- a/crates/ra_ide_api/src/runnables.rs +++ b/crates/ra_ide_api/src/runnables.rs | |||
@@ -80,11 +80,9 @@ fn runnable_mod(db: &RootDatabase, file_id: FileId, module: &ast::Module) -> Opt | |||
80 | // FIXME: thread cancellation instead of `.ok`ing | 80 | // FIXME: thread cancellation instead of `.ok`ing |
81 | let path = module | 81 | let path = module |
82 | .path_to_root(db) | 82 | .path_to_root(db) |
83 | .ok()? | ||
84 | .into_iter() | 83 | .into_iter() |
85 | .rev() | 84 | .rev() |
86 | .filter_map(|it| it.name(db).ok()) | 85 | .filter_map(|it| it.name(db)) |
87 | .filter_map(|it| it) | ||
88 | .join("::"); | 86 | .join("::"); |
89 | Some(Runnable { | 87 | Some(Runnable { |
90 | range, | 88 | range, |