File tree 1 file changed +30
-3
lines changed 1 file changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -36,11 +36,11 @@ pub(crate) fn goto_declaration(
36
36
match parent {
37
37
ast:: NameRef ( name_ref) => match NameRefClass :: classify( & sema, & name_ref) ? {
38
38
NameRefClass :: Definition ( it) => Some ( it) ,
39
- _ => None
39
+ NameRefClass :: FieldShorthand { field_ref , .. } => return field_ref . try_to_nav ( db ) ,
40
40
} ,
41
41
ast:: Name ( name) => match NameClass :: classify( & sema, & name) ? {
42
- NameClass :: Definition ( it) => Some ( it) ,
43
- _ => None
42
+ NameClass :: Definition ( it) | NameClass :: ConstReference ( it ) => Some ( it) ,
43
+ NameClass :: PatFieldShorthand { field_ref , .. } => return field_ref . try_to_nav ( db ) ,
44
44
} ,
45
45
_ => None
46
46
}
@@ -180,6 +180,33 @@ trait Trait {
180
180
impl Trait for () {
181
181
const C$0: () = ();
182
182
}
183
+ "# ,
184
+ ) ;
185
+ }
186
+
187
+ #[ test]
188
+ fn goto_decl_field_pat_shorthand ( ) {
189
+ check (
190
+ r#"
191
+ struct Foo { field: u32 }
192
+ //^^^^^
193
+ fn main() {
194
+ let Foo { field$0 };
195
+ }
196
+ "# ,
197
+ ) ;
198
+ }
199
+
200
+ #[ test]
201
+ fn goto_decl_constructor_shorthand ( ) {
202
+ check (
203
+ r#"
204
+ struct Foo { field: u32 }
205
+ //^^^^^
206
+ fn main() {
207
+ let field = 0;
208
+ Foo { field$0 };
209
+ }
183
210
"# ,
184
211
) ;
185
212
}
You can’t perform that action at this time.
0 commit comments