From 3c9f2d0e372cff6490dcd30411cb6cc1f691fde7 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 11 Apr 2019 16:39:56 +0300 Subject: simplify --- crates/ra_hir/src/code_model_api.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'crates/ra_hir/src/code_model_api.rs') 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 { } pub fn body_source_map(&self, db: &impl HirDatabase) -> Arc { - match *self { - DefWithBody::Const(ref c) => c.body_source_map(db), - DefWithBody::Function(ref f) => f.body_source_map(db), - DefWithBody::Static(ref s) => s.body_source_map(db), - } + db.body_with_source_map(*self).1 } /// Builds a resolver for code inside this item. @@ -610,6 +606,7 @@ impl Const { db.infer((*self).into()) } + #[cfg(test)] pub(crate) fn body_source_map(&self, db: &impl HirDatabase) -> Arc { db.body_with_source_map((*self).into()).1 } @@ -683,6 +680,7 @@ impl Static { db.infer((*self).into()) } + #[cfg(test)] pub(crate) fn body_source_map(&self, db: &impl HirDatabase) -> Arc { db.body_with_source_map((*self).into()).1 } -- cgit v1.2.3