Skip to content

Commit 5021f10

Browse files
committed
internal: add a test for broken refactor
1 parent f42648e commit 5021f10

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

crates/ide_assists/src/handlers/remove_unused_param.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,36 @@ use super::foo;
310310
fn bar() {
311311
let _ = foo(1);
312312
}
313+
"#,
314+
)
315+
}
316+
317+
#[test]
318+
fn remove_method_param() {
319+
// FIXME: This is completely wrong:
320+
// * method call expressions are not handled
321+
// * assoc function syntax removes the wrong argument.
322+
check_assist(
323+
remove_unused_param,
324+
r#"
325+
struct S;
326+
impl S { fn f(&self, $0_unused: i32) {} }
327+
fn main() {
328+
S.f(92);
329+
S.f();
330+
S.f(92, 92);
331+
S::f(&S, 92);
332+
}
333+
"#,
334+
r#"
335+
struct S;
336+
impl S { fn f(&self) {} }
337+
fn main() {
338+
S.f(92);
339+
S.f();
340+
S.f(92, 92);
341+
S::f(92);
342+
}
313343
"#,
314344
)
315345
}

0 commit comments

Comments
 (0)