diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-06-10 11:37:27 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-06-10 11:37:27 +0100 |
commit | f632727b2ab985a9c5ceca781d033a08ee3822ea (patch) | |
tree | b209cdea80c80c96c75ea2ded1f12ebc79d107fb /crates/ra_ide_db | |
parent | 9251f181de92c64b51e34980e591d2611b030140 (diff) | |
parent | db1cadd4447f7c580c5436a4368a4de3c67fa37a (diff) |
Merge #4834
4834: In field patterns, don't highlight local binding as a field r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_db')
-rw-r--r-- | crates/ra_ide_db/src/defs.rs | 9 |
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)] | ||
81 | pub enum NameClass { | 82 | pub 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 | ||