diff options
Diffstat (limited to 'crates/ra_hir')
-rw-r--r-- | crates/ra_hir/src/code_model_api.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model_api.rs index 40bfd5faf..3c1f7cd65 100644 --- a/crates/ra_hir/src/code_model_api.rs +++ b/crates/ra_hir/src/code_model_api.rs | |||
@@ -455,11 +455,7 @@ impl DefWithBody { | |||
455 | } | 455 | } |
456 | 456 | ||
457 | pub fn body_source_map(&self, db: &impl HirDatabase) -> Arc<BodySourceMap> { | 457 | pub fn body_source_map(&self, db: &impl HirDatabase) -> Arc<BodySourceMap> { |
458 | match *self { | 458 | db.body_with_source_map(*self).1 |
459 | DefWithBody::Const(ref c) => c.body_source_map(db), | ||
460 | DefWithBody::Function(ref f) => f.body_source_map(db), | ||
461 | DefWithBody::Static(ref s) => s.body_source_map(db), | ||
462 | } | ||
463 | } | 459 | } |
464 | 460 | ||
465 | /// Builds a resolver for code inside this item. | 461 | /// Builds a resolver for code inside this item. |
@@ -610,6 +606,7 @@ impl Const { | |||
610 | db.infer((*self).into()) | 606 | db.infer((*self).into()) |
611 | } | 607 | } |
612 | 608 | ||
609 | #[cfg(test)] | ||
613 | pub(crate) fn body_source_map(&self, db: &impl HirDatabase) -> Arc<BodySourceMap> { | 610 | pub(crate) fn body_source_map(&self, db: &impl HirDatabase) -> Arc<BodySourceMap> { |
614 | db.body_with_source_map((*self).into()).1 | 611 | db.body_with_source_map((*self).into()).1 |
615 | } | 612 | } |
@@ -683,6 +680,7 @@ impl Static { | |||
683 | db.infer((*self).into()) | 680 | db.infer((*self).into()) |
684 | } | 681 | } |
685 | 682 | ||
683 | #[cfg(test)] | ||
686 | pub(crate) fn body_source_map(&self, db: &impl HirDatabase) -> Arc<BodySourceMap> { | 684 | pub(crate) fn body_source_map(&self, db: &impl HirDatabase) -> Arc<BodySourceMap> { |
687 | db.body_with_source_map((*self).into()).1 | 685 | db.body_with_source_map((*self).into()).1 |
688 | } | 686 | } |