aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_db
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_db')
-rw-r--r--crates/ra_ide_db/src/defs.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs
index 1826f3ac6..3ef5e74b6 100644
--- a/crates/ra_ide_db/src/defs.rs
+++ b/crates/ra_ide_db/src/defs.rs
@@ -78,6 +78,7 @@ impl Definition {
78 } 78 }
79} 79}
80 80
81#[derive(Debug)]
81pub enum NameClass { 82pub enum NameClass {
82 Definition(Definition), 83 Definition(Definition),
83 /// `None` in `if let None = Some(82) {}` 84 /// `None` in `if let None = Some(82) {}`
@@ -131,9 +132,11 @@ pub fn classify_name(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Option
131 let local = sema.to_def(&it)?; 132 let local = sema.to_def(&it)?;
132 133
133 if let Some(record_field_pat) = it.syntax().parent().and_then(ast::RecordFieldPat::cast) { 134 if let Some(record_field_pat) = it.syntax().parent().and_then(ast::RecordFieldPat::cast) {
134 if let Some(field) = sema.resolve_record_field_pat(&record_field_pat) { 135 if record_field_pat.name_ref().is_none() {
135 let field = Definition::Field(field); 136 if let Some(field) = sema.resolve_record_field_pat(&record_field_pat) {
136 return Some(NameClass::FieldShorthand { local, field }); 137 let field = Definition::Field(field);
138 return Some(NameClass::FieldShorthand { local, field });
139 }
137 } 140 }
138 } 141 }
139 142