Skip to content

Commit 1f3da38

Browse files
committed
adjust test case and stop deleting newline
1 parent c9949c0 commit 1f3da38

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

crates/ide_assists/src/handlers/add_missing_match_arms.rs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -178,19 +178,6 @@ pub(crate) fn add_missing_match_arms(acc: &mut Assists, ctx: &AssistContext) ->
178178
None => Cursor::Before(first_new_arm.syntax()),
179179
};
180180
let snippet = render_snippet(cap, new_match_arm_list.syntax(), cursor);
181-
// remove the second last line if it only contains trailing whitespace
182-
let lines = snippet.lines().collect_vec();
183-
let snippet = lines
184-
.iter()
185-
.enumerate()
186-
.filter_map(|(index, &line)| {
187-
if index + 2 == lines.len() && line.trim().is_empty() {
188-
return None;
189-
}
190-
return Some(line);
191-
})
192-
.join("\n");
193-
194181
builder.replace_snippet(cap, old_range, snippet);
195182
}
196183
_ => builder.replace(old_range, new_match_arm_list.to_string()),
@@ -715,8 +702,7 @@ fn main() {
715702
let a = A::One;
716703
let b = B::One;
717704
match (a, b) {
718-
(A::Two, B::One) => {},
719-
$0
705+
(A::Two, B::One) => {},$0
720706
}
721707
}
722708
"#,

0 commit comments

Comments
 (0)