diff options
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_scope.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/src/imp.rs | 10 | ||||
-rw-r--r-- | crates/ra_ide_api/src/lib.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/src/navigation_target.rs | 8 | ||||
-rw-r--r-- | crates/ra_ide_api/src/runnables.rs | 4 |
5 files changed, 12 insertions, 14 deletions
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 | ||
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, |
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, |