Skip to content

Commit 2896849

Browse files
committed
test showing the &T issue
1 parent 486710c commit 2896849

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

crates/ide-diagnostics/src/handlers/unresolved_method.rs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,35 @@ fn main() {
334334
}
335335

336336
#[test]
337-
fn test_add_method_fix() {
337+
fn test_add_method_fix_ref_self() {
338+
check_fix(
339+
r#"
340+
struct Dolphin;
341+
342+
impl Dolphin {
343+
fn do_trick(&self) {}
344+
}
345+
346+
#[allow(unused)]
347+
fn say_hi_to(dolphin: &Dolphin) {
348+
println!("hello, {}", dolphin.name$0());
349+
}"#,
350+
r#"
351+
struct Dolphin;
352+
353+
impl Dolphin {
354+
fn do_trick(&self) {}
355+
fn name(&self) { todo!() }
356+
}
357+
358+
fn say_hi_to(dolphin: &Dolphin) {
359+
println!("hello, {}", dolphin.name());
360+
}"#,
361+
);
362+
}
363+
364+
#[test]
365+
fn test_add_method_fix_self() {
338366
check_fix(
339367
r#"
340368
struct Tiger;

0 commit comments

Comments
 (0)