Skip to content

Commit 1ee12b5

Browse files
committed
feat: add "mentoring instructions" test for pull up assist
1 parent 1755b57 commit 1ee12b5

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

crates/ide_assists/src/handlers/pull_assignment_up.rs

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ impl<'a> AssignmentsCollector<'a> {
9595
for arm in match_expr.match_arm_list()?.arms() {
9696
match arm.expr()? {
9797
ast::Expr::BlockExpr(block) => self.collect_block(&block)?,
98-
// TODO: Handle this while we are at it?
9998
_ => return None,
10099
}
101100
}
@@ -241,6 +240,38 @@ fn foo() {
241240
);
242241
}
243242

243+
#[test]
244+
#[ignore]
245+
fn test_pull_assignment_up_assignment_expressions() {
246+
check_assist(
247+
pull_assignment_up,
248+
r#"
249+
fn foo() {
250+
let mut a = 1;
251+
252+
match 1 {
253+
1 => { $0a = 2; },
254+
2 => a = 3,
255+
3 => {
256+
a = 4
257+
}
258+
}
259+
}"#,
260+
r#"
261+
fn foo() {
262+
let mut a = 1;
263+
264+
a = match 1 {
265+
1 => { 2 },
266+
2 => 3,
267+
3 => {
268+
4
269+
}
270+
};
271+
}"#,
272+
);
273+
}
274+
244275
#[test]
245276
fn test_pull_assignment_up_not_last_not_applicable() {
246277
check_assist_not_applicable(

0 commit comments

Comments
 (0)