aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_hir/src/code_model_api.rs26
-rw-r--r--crates/ra_hir/src/code_model_impl/krate.rs8
-rw-r--r--crates/ra_hir/src/code_model_impl/module.rs49
-rw-r--r--crates/ra_hir/src/ids.rs2
-rw-r--r--crates/ra_hir/src/impl_block.rs2
-rw-r--r--crates/ra_hir/src/nameres.rs4
-rw-r--r--crates/ra_hir/src/ty/method_resolution.rs4
-rw-r--r--crates/ra_ide_api/src/completion/complete_scope.rs2
-rw-r--r--crates/ra_ide_api/src/imp.rs10
-rw-r--r--crates/ra_ide_api/src/lib.rs2
-rw-r--r--crates/ra_ide_api/src/navigation_target.rs8
-rw-r--r--crates/ra_ide_api/src/runnables.rs4
12 files changed, 56 insertions, 65 deletions
diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model_api.rs
index 5db53a34f..db270b871 100644
--- a/crates/ra_hir/src/code_model_api.rs
+++ b/crates/ra_hir/src/code_model_api.rs
@@ -33,10 +33,10 @@ impl Crate {
33 pub fn crate_id(&self) -> CrateId { 33 pub fn crate_id(&self) -> CrateId {
34 self.crate_id 34 self.crate_id
35 } 35 }
36 pub fn dependencies(&self, db: &impl HirDatabase) -> Cancelable<Vec<CrateDependency>> { 36 pub fn dependencies(&self, db: &impl HirDatabase) -> Vec<CrateDependency> {
37 Ok(self.dependencies_impl(db)) 37 self.dependencies_impl(db)
38 } 38 }
39 pub fn root_module(&self, db: &impl HirDatabase) -> Cancelable<Option<Module>> { 39 pub fn root_module(&self, db: &impl HirDatabase) -> Option<Module> {
40 self.root_module_impl(db) 40 self.root_module_impl(db)
41 } 41 }
42} 42}
@@ -78,12 +78,12 @@ pub enum Problem {
78 78
79impl Module { 79impl Module {
80 /// Name of this module. 80 /// Name of this module.
81 pub fn name(&self, db: &impl HirDatabase) -> Cancelable<Option<Name>> { 81 pub fn name(&self, db: &impl HirDatabase) -> Option<Name> {
82 self.name_impl(db) 82 self.name_impl(db)
83 } 83 }
84 84
85 /// Returns a node which defines this module. That is, a file or a `mod foo {}` with items. 85 /// Returns a node which defines this module. That is, a file or a `mod foo {}` with items.
86 pub fn definition_source(&self, db: &impl HirDatabase) -> Cancelable<(FileId, ModuleSource)> { 86 pub fn definition_source(&self, db: &impl HirDatabase) -> (FileId, ModuleSource) {
87 self.definition_source_impl(db) 87 self.definition_source_impl(db)
88 } 88 }
89 89
@@ -92,19 +92,19 @@ impl Module {
92 pub fn declaration_source( 92 pub fn declaration_source(
93 &self, 93 &self,
94 db: &impl HirDatabase, 94 db: &impl HirDatabase,
95 ) -> Cancelable<Option<(FileId, TreeArc<ast::Module>)>> { 95 ) -> Option<(FileId, TreeArc<ast::Module>)> {
96 self.declaration_source_impl(db) 96 self.declaration_source_impl(db)
97 } 97 }
98 98
99 /// Returns the crate this module is part of. 99 /// Returns the crate this module is part of.
100 pub fn krate(&self, db: &impl HirDatabase) -> Cancelable<Option<Crate>> { 100 pub fn krate(&self, db: &impl HirDatabase) -> Option<Crate> {
101 self.krate_impl(db) 101 self.krate_impl(db)
102 } 102 }
103 103
104 /// Topmost parent of this module. Every module has a `crate_root`, but some 104 /// Topmost parent of this module. Every module has a `crate_root`, but some
105 /// might be missing `krate`. This can happen if a module's file is not included 105 /// might be missing `krate`. This can happen if a module's file is not included
106 /// in the module tree of any target in Cargo.toml. 106 /// in the module tree of any target in Cargo.toml.
107 pub fn crate_root(&self, db: &impl HirDatabase) -> Cancelable<Module> { 107 pub fn crate_root(&self, db: &impl HirDatabase) -> Module {
108 self.crate_root_impl(db) 108 self.crate_root_impl(db)
109 } 109 }
110 110
@@ -114,23 +114,23 @@ impl Module {
114 } 114 }
115 115
116 /// Iterates over all child modules. 116 /// Iterates over all child modules.
117 pub fn children(&self, db: &impl HirDatabase) -> Cancelable<impl Iterator<Item = Module>> { 117 pub fn children(&self, db: &impl HirDatabase) -> impl Iterator<Item = Module> {
118 self.children_impl(db) 118 self.children_impl(db)
119 } 119 }
120 120
121 /// Finds a parent module. 121 /// Finds a parent module.
122 pub fn parent(&self, db: &impl HirDatabase) -> Cancelable<Option<Module>> { 122 pub fn parent(&self, db: &impl HirDatabase) -> Option<Module> {
123 self.parent_impl(db) 123 self.parent_impl(db)
124 } 124 }
125 125
126 pub fn path_to_root(&self, db: &impl HirDatabase) -> Cancelable<Vec<Module>> { 126 pub fn path_to_root(&self, db: &impl HirDatabase) -> Vec<Module> {
127 let mut res = vec![self.clone()]; 127 let mut res = vec![self.clone()];
128 let mut curr = self.clone(); 128 let mut curr = self.clone();
129 while let Some(next) = curr.parent(db)? { 129 while let Some(next) = curr.parent(db) {
130 res.push(next.clone()); 130 res.push(next.clone());
131 curr = next 131 curr = next
132 } 132 }
133 Ok(res) 133 res
134 } 134 }
135 135
136 /// Returns a `ModuleScope`: a set of items, visible in this module. 136 /// Returns a `ModuleScope`: a set of items, visible in this module.
diff --git a/crates/ra_hir/src/code_model_impl/krate.rs b/crates/ra_hir/src/code_model_impl/krate.rs
index 712c6c86a..8c6e34873 100644
--- a/crates/ra_hir/src/code_model_impl/krate.rs
+++ b/crates/ra_hir/src/code_model_impl/krate.rs
@@ -1,4 +1,4 @@
1use ra_db::{CrateId, Cancelable}; 1use ra_db::CrateId;
2 2
3use crate::{ 3use crate::{
4 HirFileId, Crate, CrateDependency, AsName, DefLoc, DefKind, Module, SourceItemId, 4 HirFileId, Crate, CrateDependency, AsName, DefLoc, DefKind, Module, SourceItemId,
@@ -20,7 +20,7 @@ impl Crate {
20 }) 20 })
21 .collect() 21 .collect()
22 } 22 }
23 pub(crate) fn root_module_impl(&self, db: &impl HirDatabase) -> Cancelable<Option<Module>> { 23 pub(crate) fn root_module_impl(&self, db: &impl HirDatabase) -> Option<Module> {
24 let crate_graph = db.crate_graph(); 24 let crate_graph = db.crate_graph();
25 let file_id = crate_graph.crate_root(self.crate_id); 25 let file_id = crate_graph.crate_root(self.crate_id);
26 let source_root_id = db.file_source_root(file_id); 26 let source_root_id = db.file_source_root(file_id);
@@ -31,7 +31,7 @@ impl Crate {
31 file_id, 31 file_id,
32 item_id: None, 32 item_id: None,
33 }; 33 };
34 let module_id = ctry!(module_tree.find_module_by_source(source)); 34 let module_id = module_tree.find_module_by_source(source)?;
35 35
36 let def_loc = DefLoc { 36 let def_loc = DefLoc {
37 kind: DefKind::Module, 37 kind: DefKind::Module,
@@ -42,6 +42,6 @@ impl Crate {
42 let def_id = def_loc.id(db); 42 let def_id = def_loc.id(db);
43 43
44 let module = Module::new(def_id); 44 let module = Module::new(def_id);
45 Ok(Some(module)) 45 Some(module)
46 } 46 }
47} 47}
diff --git a/crates/ra_hir/src/code_model_impl/module.rs b/crates/ra_hir/src/code_model_impl/module.rs
index 67808d282..8668d6c8a 100644
--- a/crates/ra_hir/src/code_model_impl/module.rs
+++ b/crates/ra_hir/src/code_model_impl/module.rs
@@ -30,17 +30,14 @@ impl Module {
30 Module::new(def_id) 30 Module::new(def_id)
31 } 31 }
32 32
33 pub(crate) fn name_impl(&self, db: &impl HirDatabase) -> Cancelable<Option<Name>> { 33 pub(crate) fn name_impl(&self, db: &impl HirDatabase) -> Option<Name> {
34 let loc = self.def_id.loc(db); 34 let loc = self.def_id.loc(db);
35 let module_tree = db.module_tree(loc.source_root_id); 35 let module_tree = db.module_tree(loc.source_root_id);
36 let link = ctry!(loc.module_id.parent_link(&module_tree)); 36 let link = loc.module_id.parent_link(&module_tree)?;
37 Ok(Some(link.name(&module_tree).clone())) 37 Some(link.name(&module_tree).clone())
38 } 38 }
39 39
40 pub fn definition_source_impl( 40 pub fn definition_source_impl(&self, db: &impl HirDatabase) -> (FileId, ModuleSource) {
41 &self,
42 db: &impl HirDatabase,
43 ) -> Cancelable<(FileId, ModuleSource)> {
44 let loc = self.def_id.loc(db); 41 let loc = self.def_id.loc(db);
45 let file_id = loc.source_item_id.file_id.as_original_file(); 42 let file_id = loc.source_item_id.file_id.as_original_file();
46 let syntax_node = db.file_item(loc.source_item_id); 43 let syntax_node = db.file_item(loc.source_item_id);
@@ -50,40 +47,40 @@ impl Module {
50 let module = ast::Module::cast(&syntax_node).unwrap(); 47 let module = ast::Module::cast(&syntax_node).unwrap();
51 ModuleSource::Module(module.to_owned()) 48 ModuleSource::Module(module.to_owned())
52 }; 49 };
53 Ok((file_id, module_source)) 50 (file_id, module_source)
54 } 51 }
55 52
56 pub fn declaration_source_impl( 53 pub fn declaration_source_impl(
57 &self, 54 &self,
58 db: &impl HirDatabase, 55 db: &impl HirDatabase,
59 ) -> Cancelable<Option<(FileId, TreeArc<ast::Module>)>> { 56 ) -> Option<(FileId, TreeArc<ast::Module>)> {
60 let loc = self.def_id.loc(db); 57 let loc = self.def_id.loc(db);
61 let module_tree = db.module_tree(loc.source_root_id); 58 let module_tree = db.module_tree(loc.source_root_id);
62 let link = ctry!(loc.module_id.parent_link(&module_tree)); 59 let link = loc.module_id.parent_link(&module_tree)?;
63 let file_id = link 60 let file_id = link
64 .owner(&module_tree) 61 .owner(&module_tree)
65 .source(&module_tree) 62 .source(&module_tree)
66 .file_id 63 .file_id
67 .as_original_file(); 64 .as_original_file();
68 let src = link.source(&module_tree, db); 65 let src = link.source(&module_tree, db);
69 Ok(Some((file_id, src))) 66 Some((file_id, src))
70 } 67 }
71 68
72 pub(crate) fn krate_impl(&self, db: &impl HirDatabase) -> Cancelable<Option<Crate>> { 69 pub(crate) fn krate_impl(&self, db: &impl HirDatabase) -> Option<Crate> {
73 let root = self.crate_root(db)?; 70 let root = self.crate_root(db);
74 let loc = root.def_id.loc(db); 71 let loc = root.def_id.loc(db);
75 let file_id = loc.source_item_id.file_id.as_original_file(); 72 let file_id = loc.source_item_id.file_id.as_original_file();
76 73
77 let crate_graph = db.crate_graph(); 74 let crate_graph = db.crate_graph();
78 let crate_id = ctry!(crate_graph.crate_id_for_crate_root(file_id)); 75 let crate_id = crate_graph.crate_id_for_crate_root(file_id)?;
79 Ok(Some(Crate::new(crate_id))) 76 Some(Crate::new(crate_id))
80 } 77 }
81 78
82 pub(crate) fn crate_root_impl(&self, db: &impl HirDatabase) -> Cancelable<Module> { 79 pub(crate) fn crate_root_impl(&self, db: &impl HirDatabase) -> Module {
83 let loc = self.def_id.loc(db); 80 let loc = self.def_id.loc(db);
84 let module_tree = db.module_tree(loc.source_root_id); 81 let module_tree = db.module_tree(loc.source_root_id);
85 let module_id = loc.module_id.crate_root(&module_tree); 82 let module_id = loc.module_id.crate_root(&module_tree);
86 Ok(Module::from_module_id(db, loc.source_root_id, module_id)) 83 Module::from_module_id(db, loc.source_root_id, module_id)
87 } 84 }
88 85
89 /// Finds a child module with the specified name. 86 /// Finds a child module with the specified name.
@@ -95,7 +92,7 @@ impl Module {
95 } 92 }
96 93
97 /// Iterates over all child modules. 94 /// Iterates over all child modules.
98 pub fn children_impl(&self, db: &impl HirDatabase) -> Cancelable<impl Iterator<Item = Module>> { 95 pub fn children_impl(&self, db: &impl HirDatabase) -> impl Iterator<Item = Module> {
99 // FIXME this should be implementable without collecting into a vec, but 96 // FIXME this should be implementable without collecting into a vec, but
100 // it's kind of hard since the iterator needs to keep a reference to the 97 // it's kind of hard since the iterator needs to keep a reference to the
101 // module tree. 98 // module tree.
@@ -106,18 +103,14 @@ impl Module {
106 .children(&module_tree) 103 .children(&module_tree)
107 .map(|(_, module_id)| Module::from_module_id(db, loc.source_root_id, module_id)) 104 .map(|(_, module_id)| Module::from_module_id(db, loc.source_root_id, module_id))
108 .collect::<Vec<_>>(); 105 .collect::<Vec<_>>();
109 Ok(children.into_iter()) 106 children.into_iter()
110 } 107 }
111 108
112 pub fn parent_impl(&self, db: &impl HirDatabase) -> Cancelable<Option<Module>> { 109 pub fn parent_impl(&self, db: &impl HirDatabase) -> Option<Module> {
113 let loc = self.def_id.loc(db); 110 let loc = self.def_id.loc(db);
114 let module_tree = db.module_tree(loc.source_root_id); 111 let module_tree = db.module_tree(loc.source_root_id);
115 let parent_id = ctry!(loc.module_id.parent(&module_tree)); 112 let parent_id = loc.module_id.parent(&module_tree)?;
116 Ok(Some(Module::from_module_id( 113 Some(Module::from_module_id(db, loc.source_root_id, parent_id))
117 db,
118 loc.source_root_id,
119 parent_id,
120 )))
121 } 114 }
122 115
123 /// Returns a `ModuleScope`: a set of items, visible in this module. 116 /// Returns a `ModuleScope`: a set of items, visible in this module.
@@ -135,10 +128,10 @@ impl Module {
135 ) -> Cancelable<PerNs<DefId>> { 128 ) -> Cancelable<PerNs<DefId>> {
136 let mut curr_per_ns = PerNs::types( 129 let mut curr_per_ns = PerNs::types(
137 match path.kind { 130 match path.kind {
138 PathKind::Crate => self.crate_root(db)?, 131 PathKind::Crate => self.crate_root(db),
139 PathKind::Self_ | PathKind::Plain => self.clone(), 132 PathKind::Self_ | PathKind::Plain => self.clone(),
140 PathKind::Super => { 133 PathKind::Super => {
141 if let Some(p) = self.parent(db)? { 134 if let Some(p) = self.parent(db) {
142 p 135 p
143 } else { 136 } else {
144 return Ok(PerNs::none()); 137 return Ok(PerNs::none());
diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs
index d7cc9b4ca..7b572061a 100644
--- a/crates/ra_hir/src/ids.rs
+++ b/crates/ra_hir/src/ids.rs
@@ -217,7 +217,7 @@ impl DefId {
217 217
218 /// Returns the containing crate. 218 /// Returns the containing crate.
219 pub fn krate(&self, db: &impl HirDatabase) -> Cancelable<Option<Crate>> { 219 pub fn krate(&self, db: &impl HirDatabase) -> Cancelable<Option<Crate>> {
220 Ok(self.module(db)?.krate(db)?) 220 Ok(self.module(db)?.krate(db))
221 } 221 }
222 222
223 /// Returns the containing impl block, if this is an impl item. 223 /// Returns the containing impl block, if this is an impl item.
diff --git a/crates/ra_hir/src/impl_block.rs b/crates/ra_hir/src/impl_block.rs
index c9a9fb99f..ce9087b49 100644
--- a/crates/ra_hir/src/impl_block.rs
+++ b/crates/ra_hir/src/impl_block.rs
@@ -167,7 +167,7 @@ impl ModuleImplBlocks {
167 } 167 }
168 168
169 fn collect(&mut self, db: &impl HirDatabase, module: Module) -> Cancelable<()> { 169 fn collect(&mut self, db: &impl HirDatabase, module: Module) -> Cancelable<()> {
170 let (file_id, module_source) = module.definition_source(db)?; 170 let (file_id, module_source) = module.definition_source(db);
171 let node = match &module_source { 171 let node = match &module_source {
172 ModuleSource::SourceFile(node) => node.syntax(), 172 ModuleSource::SourceFile(node) => node.syntax(),
173 ModuleSource::Module(node) => node 173 ModuleSource::Module(node) => node
diff --git a/crates/ra_hir/src/nameres.rs b/crates/ra_hir/src/nameres.rs
index edb3b1e64..e51cbe786 100644
--- a/crates/ra_hir/src/nameres.rs
+++ b/crates/ra_hir/src/nameres.rs
@@ -353,8 +353,8 @@ where
353 if let Some(crate_id) = crate_graph.crate_id_for_crate_root(file_id.as_original_file()) 353 if let Some(crate_id) = crate_graph.crate_id_for_crate_root(file_id.as_original_file())
354 { 354 {
355 let krate = Crate::new(crate_id); 355 let krate = Crate::new(crate_id);
356 for dep in krate.dependencies(self.db)? { 356 for dep in krate.dependencies(self.db) {
357 if let Some(module) = dep.krate.root_module(self.db)? { 357 if let Some(module) = dep.krate.root_module(self.db) {
358 let def_id = module.def_id; 358 let def_id = module.def_id;
359 self.add_module_item( 359 self.add_module_item(
360 &mut module_items, 360 &mut module_items,
diff --git a/crates/ra_hir/src/ty/method_resolution.rs b/crates/ra_hir/src/ty/method_resolution.rs
index 7c3839388..c7fbcfd06 100644
--- a/crates/ra_hir/src/ty/method_resolution.rs
+++ b/crates/ra_hir/src/ty/method_resolution.rs
@@ -75,7 +75,7 @@ impl CrateImplBlocks {
75 } 75 }
76 } 76 }
77 77
78 for child in module.children(db)? { 78 for child in module.children(db) {
79 self.collect_recursive(db, child)?; 79 self.collect_recursive(db, child)?;
80 } 80 }
81 81
@@ -93,7 +93,7 @@ impl CrateImplBlocks {
93 source_root_id, 93 source_root_id,
94 impls: FxHashMap::default(), 94 impls: FxHashMap::default(),
95 }; 95 };
96 if let Some(module) = krate.root_module(db)? { 96 if let Some(module) = krate.root_module(db) {
97 crate_impl_blocks.collect_recursive(db, module)?; 97 crate_impl_blocks.collect_recursive(db, module)?;
98 } 98 }
99 Ok(Arc::new(crate_impl_blocks)) 99 Ok(Arc::new(crate_impl_blocks))
diff --git a/crates/ra_ide_api/src/completion/complete_scope.rs b/crates/ra_ide_api/src/completion/complete_scope.rs
index 770a0fdf2..f422bb9a7 100644
--- a/crates/ra_ide_api/src/completion/complete_scope.rs
+++ b/crates/ra_ide_api/src/completion/complete_scope.rs
@@ -20,7 +20,7 @@ pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) ->
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/imp.rs b/crates/ra_ide_api/src/imp.rs
index 76cb312dd..3ef11dfa1 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
100impl db::RootDatabase { 100impl 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,
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..7562b9a1f 100644
--- a/crates/ra_ide_api/src/navigation_target.rs
+++ b/crates/ra_ide_api/src/navigation_target.rs
@@ -73,9 +73,9 @@ impl NavigationTarget {
73 db: &RootDatabase, 73 db: &RootDatabase,
74 module: hir::Module, 74 module: hir::Module,
75 ) -> Cancelable<NavigationTarget> { 75 ) -> Cancelable<NavigationTarget> {
76 let (file_id, source) = module.definition_source(db)?; 76 let (file_id, source) = module.definition_source(db);
77 let name = module 77 let name = module
78 .name(db)? 78 .name(db)
79 .map(|it| it.to_string().into()) 79 .map(|it| it.to_string().into())
80 .unwrap_or_default(); 80 .unwrap_or_default();
81 let res = match source { 81 let res = match source {
@@ -94,10 +94,10 @@ impl NavigationTarget {
94 module: hir::Module, 94 module: hir::Module,
95 ) -> Cancelable<NavigationTarget> { 95 ) -> Cancelable<NavigationTarget> {
96 let name = module 96 let name = module
97 .name(db)? 97 .name(db)
98 .map(|it| it.to_string().into()) 98 .map(|it| it.to_string().into())
99 .unwrap_or_default(); 99 .unwrap_or_default();
100 if let Some((file_id, source)) = module.declaration_source(db)? { 100 if let Some((file_id, source)) = module.declaration_source(db) {
101 return Ok(NavigationTarget::from_syntax( 101 return Ok(NavigationTarget::from_syntax(
102 file_id, 102 file_id,
103 name, 103 name,
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,