From 784636f1c15c2b29d9cbdb5b40acfdc519cc601d Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Fri, 12 Mar 2021 20:51:08 +0100 Subject: [PATCH] Simplify a bit --- crates/hir_ty/src/traits/chalk.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/crates/hir_ty/src/traits/chalk.rs b/crates/hir_ty/src/traits/chalk.rs index 4e7d43f7ea..1a2a3a8c7f 100644 --- a/crates/hir_ty/src/traits/chalk.rs +++ b/crates/hir_ty/src/traits/chalk.rs @@ -487,19 +487,14 @@ pub(crate) fn struct_datum_query( struct_id: AdtId, ) -> Arc { debug!("struct_datum {:?}", struct_id); - let type_ctor = Ty::Adt(struct_id, Substs::empty()); let chalk_ir::AdtId(adt_id) = struct_id; - debug!("struct {:?} = {:?}", struct_id, type_ctor); let num_params = generics(db.upcast(), adt_id.into()).len(); let upstream = adt_id.module(db.upcast()).krate() != krate; - let where_clauses = type_ctor - .as_generic_def() - .map(|generic_def| { - let generic_params = generics(db.upcast(), generic_def); - let bound_vars = Substs::bound_vars(&generic_params, DebruijnIndex::INNERMOST); - convert_where_clauses(db, generic_def, &bound_vars) - }) - .unwrap_or_else(Vec::new); + let where_clauses = { + let generic_params = generics(db.upcast(), adt_id.into()); + let bound_vars = Substs::bound_vars(&generic_params, DebruijnIndex::INNERMOST); + convert_where_clauses(db, adt_id.into(), &bound_vars) + }; let flags = rust_ir::AdtFlags { upstream, // FIXME set fundamental and phantom_data flags correctly