@@ -81,12 +81,12 @@ impl Definition {
8181pub enum NameClass {
8282 ExternCrate ( Crate ) ,
8383 Definition ( Definition ) ,
84- /// `None` in `if let None = Some(82) {}`
84+ /// `None` in `if let None = Some(82) {}`.
8585 ConstReference ( Definition ) ,
86- /// `field` in `if let Foo { field } = todo!() {}`
86+ /// `field` in `if let Foo { field } = foo`.
8787 PatFieldShorthand {
88- local : Local ,
89- field : Definition ,
88+ local_def : Local ,
89+ field_ref : Definition ,
9090 } ,
9191}
9292
@@ -96,18 +96,18 @@ impl NameClass {
9696 NameClass :: ExternCrate ( krate) => Definition :: ModuleDef ( krate. root_module ( db) . into ( ) ) ,
9797 NameClass :: Definition ( it) => it,
9898 NameClass :: ConstReference ( _) => return None ,
99- /// Both `local` and `field` are definitions here, but only `local`
100- /// is the definition which is introduced by this name.
101- NameClass :: PatFieldShorthand { local , field : _ } => Definition :: Local ( local ) ,
99+ NameClass :: PatFieldShorthand { local_def , field_ref : _ } => {
100+ Definition :: Local ( local_def )
101+ }
102102 } ;
103103 Some ( res)
104104 }
105105
106- pub fn definition_or_reference ( self , db : & dyn HirDatabase ) -> Definition {
106+ pub fn reference_or_definition ( self , db : & dyn HirDatabase ) -> Definition {
107107 match self {
108108 NameClass :: ExternCrate ( krate) => Definition :: ModuleDef ( krate. root_module ( db) . into ( ) ) ,
109109 NameClass :: Definition ( it) | NameClass :: ConstReference ( it) => it,
110- NameClass :: PatFieldShorthand { local : _, field } => field ,
110+ NameClass :: PatFieldShorthand { local_def : _, field_ref } => field_ref ,
111111 }
112112 }
113113}
@@ -165,7 +165,7 @@ pub fn classify_name(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Option
165165 if record_pat_field. name_ref( ) . is_none( ) {
166166 if let Some ( field) = sema. resolve_record_pat_field( & record_pat_field) {
167167 let field = Definition :: Field ( field) ;
168- return Some ( NameClass :: PatFieldShorthand { local, field } ) ;
168+ return Some ( NameClass :: PatFieldShorthand { local_def : local, field_ref : field } ) ;
169169 }
170170 }
171171 }
0 commit comments