Skip to content

Commit f428980

Browse files
committed
move remaining warning driven actions to centralized place
1 parent cae6087 commit f428980

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

compiler/ml/cmt_utils.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ let emit_possible_actions_from_warning loc w =
2020
match w with
2121
| Warnings.Unused_open _ ->
2222
add_possible_action {loc; action = RemoveOpen; description = "Remove open"}
23+
| Unused_match | Unreachable_case ->
24+
add_possible_action
25+
{loc; action = RemoveSwitchCase; description = "Remove switch case"}
2326
| _ -> ()
2427

2528
let _ =

compiler/ml/parmatch.ml

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2200,25 +2200,12 @@ let check_unused pred casel =
22002200
let pattern = {pattern with Parsetree.ppat_loc = q.pat_loc} in
22012201
match pred constrs labels pattern with
22022202
| None ->
2203-
Cmt_utils.add_possible_action
2204-
{
2205-
loc = q.pat_loc;
2206-
action = RemoveSwitchCase;
2207-
description = "Remove switch case";
2208-
};
22092203
Location.prerr_warning q.pat_loc Warnings.Unreachable_case;
22102204
Used
22112205
| _ -> r
22122206
in
22132207
match r with
2214-
| Unused ->
2215-
Location.prerr_warning q.pat_loc Warnings.Unused_match;
2216-
Cmt_utils.add_possible_action
2217-
{
2218-
loc = q.pat_loc;
2219-
action = RemoveSwitchCase;
2220-
description = "Remove switch case";
2221-
}
2208+
| Unused -> Location.prerr_warning q.pat_loc Warnings.Unused_match
22222209
| Upartial ps ->
22232210
ps
22242211
|> List.filter (fun p ->

0 commit comments

Comments
 (0)