aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_hir/src/adt.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_hir/src/adt.rs b/crates/ra_hir/src/adt.rs
index dc936e826..2579ece19 100644
--- a/crates/ra_hir/src/adt.rs
+++ b/crates/ra_hir/src/adt.rs
@@ -118,7 +118,7 @@ pub struct EnumVariantData {
118 118
119/// A single field of an enum variant or struct 119/// A single field of an enum variant or struct
120#[derive(Debug, Clone, PartialEq, Eq)] 120#[derive(Debug, Clone, PartialEq, Eq)]
121pub struct StructField { 121pub struct StructFieldData {
122 pub(crate) name: Name, 122 pub(crate) name: Name,
123 pub(crate) type_ref: TypeRef, 123 pub(crate) type_ref: TypeRef,
124} 124}
@@ -126,13 +126,13 @@ pub struct StructField {
126/// Fields of an enum variant or struct 126/// Fields of an enum variant or struct
127#[derive(Debug, Clone, PartialEq, Eq)] 127#[derive(Debug, Clone, PartialEq, Eq)]
128pub enum VariantData { 128pub enum VariantData {
129 Struct(Vec<StructField>), 129 Struct(Vec<StructFieldData>),
130 Tuple(Vec<StructField>), 130 Tuple(Vec<StructFieldData>),
131 Unit, 131 Unit,
132} 132}
133 133
134impl VariantData { 134impl VariantData {
135 pub fn fields(&self) -> &[StructField] { 135 pub fn fields(&self) -> &[StructFieldData] {
136 match self { 136 match self {
137 VariantData::Struct(fields) | VariantData::Tuple(fields) => fields, 137 VariantData::Struct(fields) | VariantData::Tuple(fields) => fields,
138 _ => &[], 138 _ => &[],
@@ -168,7 +168,7 @@ impl VariantData {
168 let fields = fl 168 let fields = fl
169 .fields() 169 .fields()
170 .enumerate() 170 .enumerate()
171 .map(|(i, fd)| StructField { 171 .map(|(i, fd)| StructFieldData {
172 name: Name::tuple_field_name(i), 172 name: Name::tuple_field_name(i),
173 type_ref: TypeRef::from_ast_opt(fd.type_ref()), 173 type_ref: TypeRef::from_ast_opt(fd.type_ref()),
174 }) 174 })
@@ -178,7 +178,7 @@ impl VariantData {
178 StructFlavor::Named(fl) => { 178 StructFlavor::Named(fl) => {
179 let fields = fl 179 let fields = fl
180 .fields() 180 .fields()
181 .map(|fd| StructField { 181 .map(|fd| StructFieldData {
182 name: fd.name().map(|n| n.as_name()).unwrap_or_else(Name::missing), 182 name: fd.name().map(|n| n.as_name()).unwrap_or_else(Name::missing),
183 type_ref: TypeRef::from_ast_opt(fd.type_ref()), 183 type_ref: TypeRef::from_ast_opt(fd.type_ref()),
184 }) 184 })