diff options
author | Aleksey Kladov <[email protected]> | 2019-04-11 14:39:56 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-04-11 14:39:56 +0100 |
commit | 3c9f2d0e372cff6490dcd30411cb6cc1f691fde7 (patch) | |
tree | 083e317a9485fac740e1fcbd6d60de9615eafe28 /crates | |
parent | 5471c1ef4b2fda2fbaa63f7d8404abf04a3e9da4 (diff) |
simplify
Diffstat (limited to 'crates')
-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 | } |