File tree Expand file tree Collapse file tree 1 file changed +32
-1
lines changed
crates/ide_assists/src/handlers Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Original file line number Diff line number Diff 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 (
You can’t perform that action at this time.
0 commit comments