diff options
author | Aleksey Kladov <[email protected]> | 2019-01-15 15:45:01 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-15 15:45:01 +0000 |
commit | 9dd4099d9388b5f61e99f923dd6c523f76ad43ff (patch) | |
tree | c4f4a4b83eb7d5ac094b31d46979eaa513e81518 /crates | |
parent | 9446be29992fe14ec529874622311c3ae7a49b0e (diff) |
remove Cancelable from static&const API
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_hir/src/code_model_api.rs | 19 | ||||
-rw-r--r-- | crates/ra_ide_api/src/navigation_target.rs | 8 |
2 files changed, 12 insertions, 15 deletions
diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model_api.rs index cd61d922b..f6d1d6b23 100644 --- a/crates/ra_hir/src/code_model_api.rs +++ b/crates/ra_hir/src/code_model_api.rs | |||
@@ -333,8 +333,8 @@ impl Const { | |||
333 | Const { def_id } | 333 | Const { def_id } |
334 | } | 334 | } |
335 | 335 | ||
336 | pub fn source(&self, db: &impl HirDatabase) -> Cancelable<(HirFileId, TreeArc<ast::ConstDef>)> { | 336 | pub fn source(&self, db: &impl HirDatabase) -> (HirFileId, TreeArc<ast::ConstDef>) { |
337 | Ok(def_id_to_ast(db, self.def_id)) | 337 | def_id_to_ast(db, self.def_id) |
338 | } | 338 | } |
339 | } | 339 | } |
340 | 340 | ||
@@ -348,11 +348,8 @@ impl Static { | |||
348 | Static { def_id } | 348 | Static { def_id } |
349 | } | 349 | } |
350 | 350 | ||
351 | pub fn source( | 351 | pub fn source(&self, db: &impl HirDatabase) -> (HirFileId, TreeArc<ast::StaticDef>) { |
352 | &self, | 352 | def_id_to_ast(db, self.def_id) |
353 | db: &impl HirDatabase, | ||
354 | ) -> Cancelable<(HirFileId, TreeArc<ast::StaticDef>)> { | ||
355 | Ok(def_id_to_ast(db, self.def_id)) | ||
356 | } | 353 | } |
357 | } | 354 | } |
358 | 355 | ||
@@ -366,8 +363,8 @@ impl Trait { | |||
366 | Trait { def_id } | 363 | Trait { def_id } |
367 | } | 364 | } |
368 | 365 | ||
369 | pub fn source(&self, db: &impl HirDatabase) -> Cancelable<(HirFileId, TreeArc<ast::TraitDef>)> { | 366 | pub fn source(&self, db: &impl HirDatabase) -> (HirFileId, TreeArc<ast::TraitDef>) { |
370 | Ok(def_id_to_ast(db, self.def_id)) | 367 | def_id_to_ast(db, self.def_id) |
371 | } | 368 | } |
372 | } | 369 | } |
373 | 370 | ||
@@ -381,7 +378,7 @@ impl Type { | |||
381 | Type { def_id } | 378 | Type { def_id } |
382 | } | 379 | } |
383 | 380 | ||
384 | pub fn source(&self, db: &impl HirDatabase) -> Cancelable<(HirFileId, TreeArc<ast::TypeDef>)> { | 381 | pub fn source(&self, db: &impl HirDatabase) -> (HirFileId, TreeArc<ast::TypeDef>) { |
385 | Ok(def_id_to_ast(db, self.def_id)) | 382 | def_id_to_ast(db, self.def_id) |
386 | } | 383 | } |
387 | } | 384 | } |
diff --git a/crates/ra_ide_api/src/navigation_target.rs b/crates/ra_ide_api/src/navigation_target.rs index 306dbfd92..965dfc0ca 100644 --- a/crates/ra_ide_api/src/navigation_target.rs +++ b/crates/ra_ide_api/src/navigation_target.rs | |||
@@ -128,19 +128,19 @@ impl NavigationTarget { | |||
128 | NavigationTarget::from_named(file_id.original_file(db), &*node) | 128 | NavigationTarget::from_named(file_id.original_file(db), &*node) |
129 | } | 129 | } |
130 | Def::Trait(f) => { | 130 | Def::Trait(f) => { |
131 | let (file_id, node) = f.source(db)?; | 131 | let (file_id, node) = f.source(db); |
132 | NavigationTarget::from_named(file_id.original_file(db), &*node) | 132 | NavigationTarget::from_named(file_id.original_file(db), &*node) |
133 | } | 133 | } |
134 | Def::Type(f) => { | 134 | Def::Type(f) => { |
135 | let (file_id, node) = f.source(db)?; | 135 | let (file_id, node) = f.source(db); |
136 | NavigationTarget::from_named(file_id.original_file(db), &*node) | 136 | NavigationTarget::from_named(file_id.original_file(db), &*node) |
137 | } | 137 | } |
138 | Def::Static(f) => { | 138 | Def::Static(f) => { |
139 | let (file_id, node) = f.source(db)?; | 139 | let (file_id, node) = f.source(db); |
140 | NavigationTarget::from_named(file_id.original_file(db), &*node) | 140 | NavigationTarget::from_named(file_id.original_file(db), &*node) |
141 | } | 141 | } |
142 | Def::Const(f) => { | 142 | Def::Const(f) => { |
143 | let (file_id, node) = f.source(db)?; | 143 | let (file_id, node) = f.source(db); |
144 | NavigationTarget::from_named(file_id.original_file(db), &*node) | 144 | NavigationTarget::from_named(file_id.original_file(db), &*node) |
145 | } | 145 | } |
146 | Def::Module(m) => NavigationTarget::from_module(db, m)?, | 146 | Def::Module(m) => NavigationTarget::from_module(db, m)?, |