mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
Refactor the diagnostics
This commit is contained in:
parent
cfbbd91a88
commit
9963f43d51
6 changed files with 106 additions and 136 deletions
|
@ -100,8 +100,8 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
|
|||
|
||||
if let Ok(source_ptr) = source_map.expr_syntax(id) {
|
||||
let root = source_ptr.file_syntax(db.upcast());
|
||||
if let ast::Expr::RecordExpr(record_lit) = &source_ptr.value.to_node(&root) {
|
||||
if let Some(field_list) = record_lit.record_expr_field_list() {
|
||||
if let ast::Expr::RecordExpr(record_expr) = &source_ptr.value.to_node(&root) {
|
||||
if let Some(_) = record_expr.record_expr_field_list() {
|
||||
let variant_data = variant_data(db.upcast(), variant_def);
|
||||
let missed_fields = missed_fields
|
||||
.into_iter()
|
||||
|
@ -109,8 +109,8 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
|
|||
.collect();
|
||||
self.sink.push(MissingFields {
|
||||
file: source_ptr.file_id,
|
||||
field_list: AstPtr::new(&field_list),
|
||||
field_list_parent_path: record_lit.path().map(|path| AstPtr::new(&path)),
|
||||
field_list_parent: AstPtr::new(&record_expr),
|
||||
field_list_parent_path: record_expr.path().map(|path| AstPtr::new(&path)),
|
||||
missed_fields,
|
||||
})
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
|
|||
if let Some(expr) = source_ptr.value.as_ref().left() {
|
||||
let root = source_ptr.file_syntax(db.upcast());
|
||||
if let ast::Pat::RecordPat(record_pat) = expr.to_node(&root) {
|
||||
if let Some(field_list) = record_pat.record_pat_field_list() {
|
||||
if let Some(_) = record_pat.record_pat_field_list() {
|
||||
let variant_data = variant_data(db.upcast(), variant_def);
|
||||
let missed_fields = missed_fields
|
||||
.into_iter()
|
||||
|
@ -140,7 +140,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
|
|||
.collect();
|
||||
self.sink.push(MissingPatFields {
|
||||
file: source_ptr.file_id,
|
||||
field_list: AstPtr::new(&field_list),
|
||||
field_list_parent: AstPtr::new(&record_pat),
|
||||
field_list_parent_path: record_pat
|
||||
.path()
|
||||
.map(|path| AstPtr::new(&path)),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue