diff options
Diffstat (limited to 'crates/ra_hir/src/ty.rs')
-rw-r--r-- | crates/ra_hir/src/ty.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs index 03787bd89..3607969ed 100644 --- a/crates/ra_hir/src/ty.rs +++ b/crates/ra_hir/src/ty.rs | |||
@@ -463,25 +463,25 @@ fn type_for_fn(db: &impl HirDatabase, f: Function) -> Cancelable<Ty> { | |||
463 | fn type_for_struct(db: &impl HirDatabase, s: Struct) -> Cancelable<Ty> { | 463 | fn type_for_struct(db: &impl HirDatabase, s: Struct) -> Cancelable<Ty> { |
464 | Ok(Ty::Adt { | 464 | Ok(Ty::Adt { |
465 | def_id: s.def_id(), | 465 | def_id: s.def_id(), |
466 | name: s.name(db)?.unwrap_or_else(Name::missing), | 466 | name: s.name(db).unwrap_or_else(Name::missing), |
467 | }) | 467 | }) |
468 | } | 468 | } |
469 | 469 | ||
470 | pub(crate) fn type_for_enum(db: &impl HirDatabase, s: Enum) -> Cancelable<Ty> { | 470 | pub(crate) fn type_for_enum(db: &impl HirDatabase, s: Enum) -> Cancelable<Ty> { |
471 | Ok(Ty::Adt { | 471 | Ok(Ty::Adt { |
472 | def_id: s.def_id(), | 472 | def_id: s.def_id(), |
473 | name: s.name(db)?.unwrap_or_else(Name::missing), | 473 | name: s.name(db).unwrap_or_else(Name::missing), |
474 | }) | 474 | }) |
475 | } | 475 | } |
476 | 476 | ||
477 | pub(crate) fn type_for_enum_variant(db: &impl HirDatabase, ev: EnumVariant) -> Cancelable<Ty> { | 477 | pub(crate) fn type_for_enum_variant(db: &impl HirDatabase, ev: EnumVariant) -> Cancelable<Ty> { |
478 | let enum_parent = ev.parent_enum(db)?; | 478 | let enum_parent = ev.parent_enum(db); |
479 | 479 | ||
480 | type_for_enum(db, enum_parent) | 480 | type_for_enum(db, enum_parent) |
481 | } | 481 | } |
482 | 482 | ||
483 | pub(super) fn type_for_def(db: &impl HirDatabase, def_id: DefId) -> Cancelable<Ty> { | 483 | pub(super) fn type_for_def(db: &impl HirDatabase, def_id: DefId) -> Cancelable<Ty> { |
484 | let def = def_id.resolve(db)?; | 484 | let def = def_id.resolve(db); |
485 | match def { | 485 | match def { |
486 | Def::Module(..) => { | 486 | Def::Module(..) => { |
487 | log::debug!("trying to get type for module {:?}", def_id); | 487 | log::debug!("trying to get type for module {:?}", def_id); |
@@ -507,10 +507,10 @@ pub(super) fn type_for_field( | |||
507 | def_id: DefId, | 507 | def_id: DefId, |
508 | field: Name, | 508 | field: Name, |
509 | ) -> Cancelable<Option<Ty>> { | 509 | ) -> Cancelable<Option<Ty>> { |
510 | let def = def_id.resolve(db)?; | 510 | let def = def_id.resolve(db); |
511 | let variant_data = match def { | 511 | let variant_data = match def { |
512 | Def::Struct(s) => s.variant_data(db)?, | 512 | Def::Struct(s) => s.variant_data(db)?, |
513 | Def::EnumVariant(ev) => ev.variant_data(db)?, | 513 | Def::EnumVariant(ev) => ev.variant_data(db), |
514 | // TODO: unions | 514 | // TODO: unions |
515 | _ => panic!( | 515 | _ => panic!( |
516 | "trying to get type for field in non-struct/variant {:?}", | 516 | "trying to get type for field in non-struct/variant {:?}", |
@@ -877,7 +877,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
877 | } else { | 877 | } else { |
878 | return Ok((Ty::Unknown, None)); | 878 | return Ok((Ty::Unknown, None)); |
879 | }; | 879 | }; |
880 | Ok(match def_id.resolve(self.db)? { | 880 | Ok(match def_id.resolve(self.db) { |
881 | Def::Struct(s) => { | 881 | Def::Struct(s) => { |
882 | let ty = type_for_struct(self.db, s)?; | 882 | let ty = type_for_struct(self.db, s)?; |
883 | (ty, Some(def_id)) | 883 | (ty, Some(def_id)) |