From e48430cbae32249e50dda1b39e0c98a31f118250 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 24 Nov 2019 20:53:42 +0300 Subject: Simplify --- crates/ra_hir/src/ty/infer.rs | 5 ++--- crates/ra_hir/src/ty/traits/chalk.rs | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'crates/ra_hir/src/ty') diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs index 0a9a83800..ddc7d262a 100644 --- a/crates/ra_hir/src/ty/infer.rs +++ b/crates/ra_hir/src/ty/infer.rs @@ -44,8 +44,7 @@ use crate::{ db::HirDatabase, expr::{BindingAnnotation, Body, ExprId, PatId}, ty::infer::diagnostics::InferenceDiagnostic, - Adt, AssocItem, DefWithBody, FloatTy, Function, HasBody, IntTy, Path, StructField, Trait, - VariantDef, + Adt, AssocItem, DefWithBody, FloatTy, Function, IntTy, Path, StructField, Trait, VariantDef, }; macro_rules! ty_app { @@ -221,7 +220,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { coerce_unsized_map: Self::init_coerce_unsized_map(db, &resolver), db, owner, - body: owner.body(db), + body: db.body(owner.into()), resolver, } } diff --git a/crates/ra_hir/src/ty/traits/chalk.rs b/crates/ra_hir/src/ty/traits/chalk.rs index 9efdc53c4..1a93e5e50 100644 --- a/crates/ra_hir/src/ty/traits/chalk.rs +++ b/crates/ra_hir/src/ty/traits/chalk.rs @@ -19,7 +19,7 @@ use crate::{ db::HirDatabase, ty::display::HirDisplay, ty::{ApplicationTy, GenericPredicate, ProjectionTy, Substs, TraitRef, Ty, TypeCtor, TypeWalk}, - Crate, GenericDef, HasBody, ImplBlock, Trait, TypeAlias, + Crate, GenericDef, ImplBlock, Trait, TypeAlias, }; /// This represents a trait whose name we could not resolve. @@ -715,7 +715,7 @@ fn closure_fn_trait_impl_datum( let fn_once_trait = get_fn_trait(db, krate, super::FnTrait::FnOnce)?; fn_once_trait.associated_type_by_name(db, &name::OUTPUT_TYPE)?; - let num_args: u16 = match &data.def.body(db)[data.expr] { + let num_args: u16 = match &db.body(data.def.into())[data.expr] { crate::expr::Expr::Lambda { args, .. } => args.len() as u16, _ => { log::warn!("closure for closure type {:?} not found", data); @@ -805,7 +805,7 @@ fn closure_fn_trait_output_assoc_ty_value( ) -> Arc> { let impl_id = Impl::ClosureFnTraitImpl(data.clone()).to_chalk(db); - let num_args: u16 = match &data.def.body(db)[data.expr] { + let num_args: u16 = match &db.body(data.def.into())[data.expr] { crate::expr::Expr::Lambda { args, .. } => args.len() as u16, _ => { log::warn!("closure for closure type {:?} not found", data); -- cgit v1.2.3