aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ide/src/inlay_hints.rs25
1 files changed, 23 insertions, 2 deletions
diff --git a/crates/ide/src/inlay_hints.rs b/crates/ide/src/inlay_hints.rs
index ac704ae21..6cfb22e13 100644
--- a/crates/ide/src/inlay_hints.rs
+++ b/crates/ide/src/inlay_hints.rs
@@ -162,7 +162,7 @@ fn get_param_name_hints(
162 .zip(args) 162 .zip(args)
163 .filter_map(|((param, _ty), arg)| { 163 .filter_map(|((param, _ty), arg)| {
164 let param_name = match param? { 164 let param_name = match param? {
165 Either::Left(self_param) => self_param.to_string(), 165 Either::Left(_) => "self".to_string(),
166 Either::Right(pat) => match pat { 166 Either::Right(pat) => match pat {
167 ast::Pat::IdentPat(it) => it.name()?.to_string(), 167 ast::Pat::IdentPat(it) => it.name()?.to_string(),
168 _ => return None, 168 _ => return None,
@@ -809,7 +809,7 @@ fn main() {
809 t.method(123); 809 t.method(123);
810 //^^^ param 810 //^^^ param
811 Test::method(&t, 3456); 811 Test::method(&t, 3456);
812 //^^ &self ^^^^ param 812 //^^ self ^^^^ param
813 Test::from_syntax( 813 Test::from_syntax(
814 FileId {}, 814 FileId {},
815 //^^^^^^^^^ file_id 815 //^^^^^^^^^ file_id
@@ -1360,4 +1360,25 @@ fn main() {
1360 "#, 1360 "#,
1361 ); 1361 );
1362 } 1362 }
1363
1364 #[test]
1365 fn self_param_hints() {
1366 check(
1367 r#"
1368struct Foo;
1369
1370impl Foo {
1371 fn foo(self: Self) {}
1372 fn bar(self: &Self) {}
1373}
1374
1375fn main() {
1376 Foo::foo(Foo);
1377 //^^^ self
1378 Foo::bar(&Foo);
1379 //^^^^ self
1380}
1381"#,
1382 )
1383 }
1363} 1384}