Skip to content

Commit 3d9ce6b

Browse files
committed
cov_mark for add_missing_match_arms special cases
1 parent 1c0eed5 commit 3d9ce6b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

crates/ide_assists/src/handlers/add_missing_match_arms.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ pub(crate) fn add_missing_match_arms(acc: &mut Assists, ctx: &AssistContext) ->
5050

5151
let cursor_in_range = target_range.contains_range(ctx.selection_trimmed());
5252
if !cursor_in_range {
53+
cov_mark::hit!(not_applicable_outside_of_range_right);
5354
return None;
5455
}
5556
} else {
@@ -199,6 +200,7 @@ fn cursor_at_trivial_match_arm_list(
199200
) -> Option<()> {
200201
// match x { $0 }
201202
if match_arm_list.arms().next() == None {
203+
cov_mark::hit!(add_missing_match_arms_empty_body);
202204
return Some(());
203205
}
204206

@@ -207,6 +209,7 @@ fn cursor_at_trivial_match_arm_list(
207209
let arm = wild_pat.syntax().parent().and_then(ast::MatchArm::cast)?;
208210
let arm_match_expr = arm.syntax().ancestors().nth(2).and_then(ast::MatchExpr::cast)?;
209211
if arm_match_expr == *match_expr {
212+
cov_mark::hit!(add_missing_match_arms_trivial_arm);
210213
return Some(());
211214
}
212215

@@ -360,6 +363,7 @@ fn foo(a: A) {
360363

361364
#[test]
362365
fn not_applicable_outside_of_range_right() {
366+
cov_mark::check!(not_applicable_outside_of_range_right);
363367
check_assist_not_applicable(
364368
add_missing_match_arms,
365369
r#"
@@ -651,6 +655,7 @@ fn main() {
651655

652656
#[test]
653657
fn add_missing_match_arms_empty_body() {
658+
cov_mark::check!(add_missing_match_arms_empty_body);
654659
check_assist(
655660
add_missing_match_arms,
656661
r#"
@@ -954,6 +959,7 @@ fn main() {
954959

955960
#[test]
956961
fn add_missing_match_arms_trivial_arm() {
962+
cov_mark::check!(add_missing_match_arms_trivial_arm);
957963
check_assist(
958964
add_missing_match_arms,
959965
r#"

0 commit comments

Comments
 (0)