Skip to content

Commit 458dd88

Browse files
committed
Silence some warnings.
1 parent 3015e23 commit 458dd88

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

ppx_regexp.ml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,20 +108,21 @@ let transform_cases ~loc e cases =
108108
if case.pc_guard <> None then
109109
error ~loc "Guards are not implemented for match%pcre." else
110110
(match case.pc_lhs with
111-
| {ppat_desc = Ppat_constant (Pconst_string (re_src,_)); ppat_loc = loc} ->
111+
| { ppat_desc = Ppat_constant (Pconst_string (re_src,_));
112+
ppat_loc = loc; _ } ->
112113
let re_str, bs, nG = extract_bindings ~loc re_src in
113114
(try ignore (Re_pcre.regexp re_str) with
114115
| Re_perl.Not_supported -> error ~loc "Unsupported regular expression."
115116
| Re_perl.Parse_error -> error ~loc "Invalid regular expression.");
116117
(Exp.constant (Const.string re_str), nG, bs, case.pc_rhs)
117-
| {ppat_desc = Ppat_any} ->
118+
| {ppat_desc = Ppat_any; _} ->
118119
error ~loc "Universal wildcard must be the last pattern."
119-
| {ppat_loc = loc} ->
120+
| {ppat_loc = loc; _} ->
120121
error ~loc "Regular expression pattern should be a string.")
121122
in
122123
let cases, default_rhs =
123124
(match List.rev cases with
124-
| {pc_lhs = {ppat_desc = Ppat_any}; pc_rhs} :: cases ->
125+
| {pc_lhs = {ppat_desc = Ppat_any; _}; pc_rhs; _} :: cases ->
125126
(cases, pc_rhs)
126127
| cases ->
127128
let open Lexing in
@@ -175,7 +176,8 @@ let transform_cases ~loc e cases =
175176

176177
let rewrite_expr mapper e_ext =
177178
(match e_ext.pexp_desc with
178-
| Pexp_extension ({txt = "pcre"}, PStr [{pstr_desc = Pstr_eval (e, _)}]) ->
179+
| Pexp_extension ({txt = "pcre"; _},
180+
PStr [{pstr_desc = Pstr_eval (e, _); _}]) ->
179181
let loc = e.pexp_loc in
180182
(match e.pexp_desc with
181183
| Pexp_match (e, cases) ->
@@ -186,7 +188,7 @@ let rewrite_expr mapper e_ext =
186188
error ~loc "[%pcre] only applies to match an function.")
187189
| _ -> default_mapper.expr mapper e_ext)
188190

189-
let rewrite_structure mapper sis =
191+
let rewrite_structure _mapper sis =
190192
let sis' =
191193
default_mapper.structure {default_mapper with expr = rewrite_expr} sis
192194
in

0 commit comments

Comments
 (0)