File tree Expand file tree Collapse file tree 1 file changed +29
-8
lines changed Expand file tree Collapse file tree 1 file changed +29
-8
lines changed Original file line number Diff line number Diff line change @@ -182,16 +182,18 @@ fn show_implementations_action(db: &RootDatabase, def: Definition) -> Option<Hov
182
182
} )
183
183
}
184
184
185
- match def {
186
- Definition :: ModuleDef ( it) => match it {
187
- ModuleDef :: Adt ( Adt :: Struct ( it) ) => Some ( to_action ( it. try_to_nav ( db) ?) ) ,
188
- ModuleDef :: Adt ( Adt :: Union ( it) ) => Some ( to_action ( it. try_to_nav ( db) ?) ) ,
189
- ModuleDef :: Adt ( Adt :: Enum ( it) ) => Some ( to_action ( it. try_to_nav ( db) ?) ) ,
190
- ModuleDef :: Trait ( it) => Some ( to_action ( it. try_to_nav ( db) ?) ) ,
191
- _ => None ,
192
- } ,
185
+ let adt = match def {
186
+ Definition :: ModuleDef ( ModuleDef :: Trait ( it) ) => return it. try_to_nav ( db) . map ( to_action) ,
187
+ Definition :: ModuleDef ( ModuleDef :: Adt ( it) ) => Some ( it) ,
188
+ Definition :: SelfType ( it) => it. target_ty ( db) . as_adt ( ) ,
193
189
_ => None ,
190
+ } ?;
191
+ match adt {
192
+ Adt :: Struct ( it) => it. try_to_nav ( db) ,
193
+ Adt :: Union ( it) => it. try_to_nav ( db) ,
194
+ Adt :: Enum ( it) => it. try_to_nav ( db) ,
194
195
}
196
+ . map ( to_action)
195
197
}
196
198
197
199
fn runnable_action (
@@ -2174,6 +2176,25 @@ fn foo() { let bar = Bar; bar.fo<|>o(); }
2174
2176
) ;
2175
2177
}
2176
2178
2179
+ #[ test]
2180
+ fn test_hover_self_has_impl_action ( ) {
2181
+ check_actions (
2182
+ r#"struct foo where Self<|>:;"# ,
2183
+ expect ! [ [ r#"
2184
+ [
2185
+ Implementation(
2186
+ FilePosition {
2187
+ file_id: FileId(
2188
+ 0,
2189
+ ),
2190
+ offset: 7,
2191
+ },
2192
+ ),
2193
+ ]
2194
+ "# ] ] ,
2195
+ ) ;
2196
+ }
2197
+
2177
2198
#[ test]
2178
2199
fn test_hover_test_has_action ( ) {
2179
2200
check_actions (
You can’t perform that action at this time.
0 commit comments