Skip to content

Commit 2e3a3a2

Browse files
committed
test showing the &T issue
1 parent 2b06611 commit 2e3a3a2

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
@@ -331,7 +331,35 @@ fn main() {
331331
}
332332

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

0 commit comments

Comments
 (0)