aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ide_assists/src/handlers/extract_function.rs32
1 files changed, 32 insertions, 0 deletions
diff --git a/crates/ide_assists/src/handlers/extract_function.rs b/crates/ide_assists/src/handlers/extract_function.rs
index 8e295098f..719f22053 100644
--- a/crates/ide_assists/src/handlers/extract_function.rs
+++ b/crates/ide_assists/src/handlers/extract_function.rs
@@ -3384,4 +3384,36 @@ fn foo() -> Result<(), i64> {
3384}"##, 3384}"##,
3385 ); 3385 );
3386 } 3386 }
3387
3388 #[test]
3389 fn param_usage_in_macro() {
3390 check_assist(
3391 extract_function,
3392 r"
3393macro_rules! m {
3394 ($val:expr) => { $val };
3395}
3396
3397fn foo() {
3398 let n = 1;
3399 $0let k = n * m!(n);$0
3400 let m = k + 1;
3401}",
3402 r"
3403macro_rules! m {
3404 ($val:expr) => { $val };
3405}
3406
3407fn foo() {
3408 let n = 1;
3409 let k = fun_name(n);
3410 let m = k + 1;
3411}
3412
3413fn $0fun_name(n: i32) -> i32 {
3414 let k = n * m!(n);
3415 k
3416}",
3417 );
3418 }
3387} 3419}