diff options
Diffstat (limited to 'crates/ra_hir_ty')
-rw-r--r-- | crates/ra_hir_ty/src/lib.rs | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/crates/ra_hir_ty/src/lib.rs b/crates/ra_hir_ty/src/lib.rs index c9ee34008..b45c8f82f 100644 --- a/crates/ra_hir_ty/src/lib.rs +++ b/crates/ra_hir_ty/src/lib.rs | |||
@@ -901,12 +901,10 @@ impl HirDisplay for ApplicationTy { | |||
901 | let sig = f.db.callable_item_signature(def); | 901 | let sig = f.db.callable_item_signature(def); |
902 | let name = match def { | 902 | let name = match def { |
903 | CallableDef::FunctionId(ff) => f.db.function_data(ff).name.clone(), | 903 | CallableDef::FunctionId(ff) => f.db.function_data(ff).name.clone(), |
904 | CallableDef::StructId(s) => { | 904 | CallableDef::StructId(s) => f.db.struct_data(s).name.clone(), |
905 | f.db.struct_data(s).name.clone().unwrap_or_else(Name::missing) | ||
906 | } | ||
907 | CallableDef::EnumVariantId(e) => { | 905 | CallableDef::EnumVariantId(e) => { |
908 | let enum_data = f.db.enum_data(e.parent); | 906 | let enum_data = f.db.enum_data(e.parent); |
909 | enum_data.variants[e.local_id].name.clone().unwrap_or_else(Name::missing) | 907 | enum_data.variants[e.local_id].name.clone() |
910 | } | 908 | } |
911 | }; | 909 | }; |
912 | match def { | 910 | match def { |
@@ -929,8 +927,7 @@ impl HirDisplay for ApplicationTy { | |||
929 | AdtId::StructId(it) => f.db.struct_data(it).name.clone(), | 927 | AdtId::StructId(it) => f.db.struct_data(it).name.clone(), |
930 | AdtId::UnionId(it) => f.db.union_data(it).name.clone(), | 928 | AdtId::UnionId(it) => f.db.union_data(it).name.clone(), |
931 | AdtId::EnumId(it) => f.db.enum_data(it).name.clone(), | 929 | AdtId::EnumId(it) => f.db.enum_data(it).name.clone(), |
932 | } | 930 | }; |
933 | .unwrap_or_else(Name::missing); | ||
934 | write!(f, "{}", name)?; | 931 | write!(f, "{}", name)?; |
935 | if self.parameters.len() > 0 { | 932 | if self.parameters.len() > 0 { |
936 | write!(f, "<")?; | 933 | write!(f, "<")?; |
@@ -943,7 +940,7 @@ impl HirDisplay for ApplicationTy { | |||
943 | ContainerId::TraitId(it) => it, | 940 | ContainerId::TraitId(it) => it, |
944 | _ => panic!("not an associated type"), | 941 | _ => panic!("not an associated type"), |
945 | }; | 942 | }; |
946 | let trait_name = f.db.trait_data(trait_).name.clone().unwrap_or_else(Name::missing); | 943 | let trait_name = f.db.trait_data(trait_).name.clone(); |
947 | let name = f.db.type_alias_data(type_alias).name.clone(); | 944 | let name = f.db.type_alias_data(type_alias).name.clone(); |
948 | write!(f, "{}::{}", trait_name, name)?; | 945 | write!(f, "{}::{}", trait_name, name)?; |
949 | if self.parameters.len() > 0 { | 946 | if self.parameters.len() > 0 { |
@@ -971,8 +968,7 @@ impl HirDisplay for ProjectionTy { | |||
971 | return write!(f, "…"); | 968 | return write!(f, "…"); |
972 | } | 969 | } |
973 | 970 | ||
974 | let trait_name = | 971 | let trait_name = f.db.trait_data(self.trait_(f.db)).name.clone(); |
975 | f.db.trait_data(self.trait_(f.db)).name.clone().unwrap_or_else(Name::missing); | ||
976 | write!(f, "<{} as {}", self.parameters[0].display(f.db), trait_name,)?; | 972 | write!(f, "<{} as {}", self.parameters[0].display(f.db), trait_name,)?; |
977 | if self.parameters.len() > 1 { | 973 | if self.parameters.len() > 1 { |
978 | write!(f, "<")?; | 974 | write!(f, "<")?; |
@@ -1021,14 +1017,7 @@ impl HirDisplay for Ty { | |||
1021 | // We assume that the self type is $0 (i.e. the | 1017 | // We assume that the self type is $0 (i.e. the |
1022 | // existential) here, which is the only thing that's | 1018 | // existential) here, which is the only thing that's |
1023 | // possible in actual Rust, and hence don't print it | 1019 | // possible in actual Rust, and hence don't print it |
1024 | write!( | 1020 | write!(f, "{}", f.db.trait_data(trait_ref.trait_).name.clone())?; |
1025 | f, | ||
1026 | "{}", | ||
1027 | f.db.trait_data(trait_ref.trait_) | ||
1028 | .name | ||
1029 | .clone() | ||
1030 | .unwrap_or_else(Name::missing) | ||
1031 | )?; | ||
1032 | if trait_ref.substs.len() > 1 { | 1021 | if trait_ref.substs.len() > 1 { |
1033 | write!(f, "<")?; | 1022 | write!(f, "<")?; |
1034 | f.write_joined(&trait_ref.substs[1..], ", ")?; | 1023 | f.write_joined(&trait_ref.substs[1..], ", ")?; |
@@ -1088,7 +1077,7 @@ impl TraitRef { | |||
1088 | } else { | 1077 | } else { |
1089 | write!(f, ": ")?; | 1078 | write!(f, ": ")?; |
1090 | } | 1079 | } |
1091 | write!(f, "{}", f.db.trait_data(self.trait_).name.clone().unwrap_or_else(Name::missing))?; | 1080 | write!(f, "{}", f.db.trait_data(self.trait_).name.clone())?; |
1092 | if self.substs.len() > 1 { | 1081 | if self.substs.len() > 1 { |
1093 | write!(f, "<")?; | 1082 | write!(f, "<")?; |
1094 | f.write_joined(&self.substs[1..], ", ")?; | 1083 | f.write_joined(&self.substs[1..], ", ")?; |