Skip to content

Commit 4d97f5f

Browse files
committed
Rename record_field_pat to record_pat_field
1 parent 5c336e2 commit 4d97f5f

File tree

10 files changed

+17
-17
lines changed

10 files changed

+17
-17
lines changed

crates/hir/src/semantics.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> {
207207
self.imp.resolve_record_field(field)
208208
}
209209

210-
pub fn resolve_record_field_pat(&self, field: &ast::RecordPatField) -> Option<Field> {
211-
self.imp.resolve_record_field_pat(field)
210+
pub fn resolve_record_pat_field(&self, field: &ast::RecordPatField) -> Option<Field> {
211+
self.imp.resolve_record_pat_field(field)
212212
}
213213

214214
pub fn resolve_macro_call(&self, macro_call: &ast::MacroCall) -> Option<MacroDef> {
@@ -433,8 +433,8 @@ impl<'db> SemanticsImpl<'db> {
433433
self.analyze(field.syntax()).resolve_record_field(self.db, field)
434434
}
435435

436-
fn resolve_record_field_pat(&self, field: &ast::RecordPatField) -> Option<Field> {
437-
self.analyze(field.syntax()).resolve_record_field_pat(self.db, field)
436+
fn resolve_record_pat_field(&self, field: &ast::RecordPatField) -> Option<Field> {
437+
self.analyze(field.syntax()).resolve_record_pat_field(self.db, field)
438438
}
439439

440440
fn resolve_macro_call(&self, macro_call: &ast::MacroCall) -> Option<MacroDef> {

crates/hir/src/source_analyzer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,13 @@ impl SourceAnalyzer {
179179
Some((struct_field.into(), local))
180180
}
181181

182-
pub(crate) fn resolve_record_field_pat(
182+
pub(crate) fn resolve_record_pat_field(
183183
&self,
184184
_db: &dyn HirDatabase,
185185
field: &ast::RecordPatField,
186186
) -> Option<Field> {
187187
let pat_id = self.pat_id(&field.pat()?)?;
188-
let struct_field = self.infer.as_ref()?.record_field_pat_resolution(pat_id)?;
188+
let struct_field = self.infer.as_ref()?.record_pat_field_resolution(pat_id)?;
189189
Some(struct_field.into())
190190
}
191191

crates/hir_ty/src/infer.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ pub struct InferenceResult {
125125
field_resolutions: FxHashMap<ExprId, FieldId>,
126126
/// For each field in record literal, records the field it resolves to.
127127
record_field_resolutions: FxHashMap<ExprId, FieldId>,
128-
record_field_pat_resolutions: FxHashMap<PatId, FieldId>,
128+
record_pat_field_resolutions: FxHashMap<PatId, FieldId>,
129129
/// For each struct literal, records the variant it resolves to.
130130
variant_resolutions: FxHashMap<ExprOrPatId, VariantId>,
131131
/// For each associated item record what it resolves to
@@ -146,8 +146,8 @@ impl InferenceResult {
146146
pub fn record_field_resolution(&self, expr: ExprId) -> Option<FieldId> {
147147
self.record_field_resolutions.get(&expr).copied()
148148
}
149-
pub fn record_field_pat_resolution(&self, pat: PatId) -> Option<FieldId> {
150-
self.record_field_pat_resolutions.get(&pat).copied()
149+
pub fn record_pat_field_resolution(&self, pat: PatId) -> Option<FieldId> {
150+
self.record_pat_field_resolutions.get(&pat).copied()
151151
}
152152
pub fn variant_resolution_for_expr(&self, id: ExprId) -> Option<VariantId> {
153153
self.variant_resolutions.get(&id.into()).copied()

crates/hir_ty/src/infer/pat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl<'a> InferenceContext<'a> {
7070
let matching_field = var_data.as_ref().and_then(|it| it.field(&subpat.name));
7171
if let Some(local_id) = matching_field {
7272
let field_def = FieldId { parent: def.unwrap(), local_id };
73-
self.result.record_field_pat_resolutions.insert(subpat.pat, field_def);
73+
self.result.record_pat_field_resolutions.insert(subpat.pat, field_def);
7474
}
7575

7676
let expected_ty =

crates/ide_db/src/defs.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ pub fn classify_name(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Option
157157
ast::IdentPat(it) => {
158158
let local = sema.to_def(&it)?;
159159

160-
if let Some(record_field_pat) = it.syntax().parent().and_then(ast::RecordPatField::cast) {
161-
if record_field_pat.name_ref().is_none() {
162-
if let Some(field) = sema.resolve_record_field_pat(&record_field_pat) {
160+
if let Some(record_pat_field) = it.syntax().parent().and_then(ast::RecordPatField::cast) {
161+
if record_pat_field.name_ref().is_none() {
162+
if let Some(field) = sema.resolve_record_pat_field(&record_pat_field) {
163163
let field = Definition::Field(field);
164164
return Some(NameClass::FieldShorthand { local, field });
165165
}
@@ -275,8 +275,8 @@ pub fn classify_name_ref(
275275
}
276276
}
277277

278-
if let Some(record_field_pat) = ast::RecordPatField::cast(parent.clone()) {
279-
if let Some(field) = sema.resolve_record_field_pat(&record_field_pat) {
278+
if let Some(record_pat_field) = ast::RecordPatField::cast(parent.clone()) {
279+
if let Some(field) = sema.resolve_record_pat_field(&record_pat_field) {
280280
let field = Definition::Field(field);
281281
return Some(NameRefClass::Definition(field));
282282
}

crates/parser/src/grammar/patterns.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ fn tuple_pat_fields(p: &mut Parser) {
188188
p.expect(T![')']);
189189
}
190190

191-
// test record_field_pat_list
191+
// test record_pat_field_list
192192
// fn foo() {
193193
// let S {} = ();
194194
// let S { f, ref mut g } = ();
@@ -208,7 +208,7 @@ fn record_pat_field_list(p: &mut Parser) {
208208
c => {
209209
let m = p.start();
210210
match c {
211-
// test record_field_pat
211+
// test record_pat_field
212212
// fn foo() {
213213
// let S { 0: 1 } = ();
214214
// let S { x: 1 } = ();

0 commit comments

Comments
 (0)