aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/diagnostics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src/diagnostics.rs')
-rw-r--r--crates/ra_ide/src/diagnostics.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs
index 897177d05..dd8a7ffd9 100644
--- a/crates/ra_ide/src/diagnostics.rs
+++ b/crates/ra_ide/src/diagnostics.rs
@@ -146,7 +146,7 @@ fn missing_struct_field_fix(
146) -> Option<Fix> { 146) -> Option<Fix> {
147 let record_expr = sema.ast(d); 147 let record_expr = sema.ast(d);
148 148
149 let record_lit = ast::RecordLit::cast(record_expr.syntax().parent()?.parent()?)?; 149 let record_lit = ast::RecordExpr::cast(record_expr.syntax().parent()?.parent()?)?;
150 let def_id = sema.resolve_variant(record_lit)?; 150 let def_id = sema.resolve_variant(record_lit)?;
151 let module; 151 let module;
152 let def_file_id; 152 let def_file_id;
@@ -155,21 +155,21 @@ fn missing_struct_field_fix(
155 module = s.module(sema.db); 155 module = s.module(sema.db);
156 let source = s.source(sema.db); 156 let source = s.source(sema.db);
157 def_file_id = source.file_id; 157 def_file_id = source.file_id;
158 let fields = source.value.field_def_list()?; 158 let fields = source.value.field_list()?;
159 record_field_def_list(fields)? 159 record_field_list(fields)?
160 } 160 }
161 VariantDef::Union(u) => { 161 VariantDef::Union(u) => {
162 module = u.module(sema.db); 162 module = u.module(sema.db);
163 let source = u.source(sema.db); 163 let source = u.source(sema.db);
164 def_file_id = source.file_id; 164 def_file_id = source.file_id;
165 source.value.record_field_def_list()? 165 source.value.record_field_list()?
166 } 166 }
167 VariantDef::EnumVariant(e) => { 167 VariantDef::EnumVariant(e) => {
168 module = e.module(sema.db); 168 module = e.module(sema.db);
169 let source = e.source(sema.db); 169 let source = e.source(sema.db);
170 def_file_id = source.file_id; 170 def_file_id = source.file_id;
171 let fields = source.value.field_def_list()?; 171 let fields = source.value.field_list()?;
172 record_field_def_list(fields)? 172 record_field_list(fields)?
173 } 173 }
174 }; 174 };
175 let def_file_id = def_file_id.original_file(sema.db); 175 let def_file_id = def_file_id.original_file(sema.db);
@@ -205,10 +205,10 @@ fn missing_struct_field_fix(
205 let fix = Fix::new("Create field", source_change.into()); 205 let fix = Fix::new("Create field", source_change.into());
206 return Some(fix); 206 return Some(fix);
207 207
208 fn record_field_def_list(field_def_list: ast::FieldDefList) -> Option<ast::RecordFieldDefList> { 208 fn record_field_list(field_def_list: ast::FieldList) -> Option<ast::RecordFieldList> {
209 match field_def_list { 209 match field_def_list {
210 ast::FieldDefList::RecordFieldDefList(it) => Some(it), 210 ast::FieldList::RecordFieldList(it) => Some(it),
211 ast::FieldDefList::TupleFieldDefList(_) => None, 211 ast::FieldList::TupleFieldList(_) => None,
212 } 212 }
213 } 213 }
214} 214}
@@ -263,8 +263,8 @@ fn check_struct_shorthand_initialization(
263 file_id: FileId, 263 file_id: FileId,
264 node: &SyntaxNode, 264 node: &SyntaxNode,
265) -> Option<()> { 265) -> Option<()> {
266 let record_lit = ast::RecordLit::cast(node.clone())?; 266 let record_lit = ast::RecordExpr::cast(node.clone())?;
267 let record_field_list = record_lit.record_field_list()?; 267 let record_field_list = record_lit.record_expr_field_list()?;
268 for record_field in record_field_list.fields() { 268 for record_field in record_field_list.fields() {
269 if let (Some(name_ref), Some(expr)) = (record_field.name_ref(), record_field.expr()) { 269 if let (Some(name_ref), Some(expr)) = (record_field.name_ref(), record_field.expr()) {
270 let field_name = name_ref.syntax().text().to_string(); 270 let field_name = name_ref.syntax().text().to_string();