Skip to content

Commit e03ec5b

Browse files
authored
fmt: format using OCamlformat 0.28 (#75)
1 parent b723841 commit e03ec5b

File tree

6 files changed

+181
-185
lines changed

6 files changed

+181
-185
lines changed

examples/decode.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
let mapJsonObjectString f decoder (encoder : int -> Js.Json.t) str =
33
let json = Melange_json.of_string str in
44
Melange_json.Of_json.(js_dict decoder json)
5-
|> Js.Dict.map ~f:(fun [@u] v -> f v)
5+
|> Js.Dict.map ~f:(fun[@u] v -> f v)
66
|> Melange_json.To_json.js_dict encoder
77
|> Melange_json.to_string
88

ppx/native/common/ppx_deriving_json_common.ml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ let get_of_variant_case ?mark_as_seen ~variant ~polyvariant = function
77
| Vcs_ctx_variant ctx -> Attribute.get ?mark_as_seen variant ctx
88
| Vcs_ctx_polyvariant ctx -> Attribute.get ?mark_as_seen polyvariant ctx
99

10-
1110
let get_of_variant ?mark_as_seen ~variant ~polyvariant = function
1211
| Vrt_ctx_variant ctx -> Attribute.get ?mark_as_seen variant ctx
1312
| Vrt_ctx_polyvariant ctx -> Attribute.get ?mark_as_seen polyvariant ctx
@@ -24,8 +23,6 @@ let vcs_attr_json_name =
2423
let polyvariant = attr_json_name Attribute.Context.rtag in
2524
get_of_variant_case ~variant ~polyvariant
2625

27-
28-
2926
let attr_json_allow_any ctx = Attribute.declare_flag "json.allow_any" ctx
3027

3128
let vcs_attr_json_allow_any =

ppx/native/common/ppx_deriving_tools.ml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ module Conv = struct
409409
let allow_any_constr =
410410
cs
411411
|> List.find_opt ~f:(fun cs ->
412-
is_allow_any_constr (Vcs_ctx_variant cs))
412+
is_allow_any_constr (Vcs_ctx_variant cs))
413413
|> Option.map (fun cs e -> econstruct cs (Some e))
414414
in
415415
let cs =
@@ -479,13 +479,13 @@ module Conv = struct
479479
let allow_any_constr =
480480
cs
481481
|> List.find_opt ~f:(fun cs ->
482-
is_allow_any_constr (Vcs_ctx_polyvariant cs))
482+
is_allow_any_constr (Vcs_ctx_polyvariant cs))
483483
|> Option.map (fun cs ->
484-
match cs.prf_desc with
485-
| Rinherit _ ->
486-
failwith "[@allow_any] placed on inherit clause"
487-
| Rtag (n, _, _) ->
488-
fun e -> pexp_variant ~loc:n.loc n.txt (Some e))
484+
match cs.prf_desc with
485+
| Rinherit _ ->
486+
failwith "[@allow_any] placed on inherit clause"
487+
| Rtag (n, _, _) ->
488+
fun e -> pexp_variant ~loc:n.loc n.txt (Some e))
489489
in
490490
let cs =
491491
List.filter

ppx/native/ppx_deriving_json_native.ml

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -195,24 +195,23 @@ module To_json = struct
195195
let e =
196196
List.combine t.rcd_fields es
197197
|> List.fold_left ~init:ebnds ~f:(fun acc (ld, x) ->
198-
let key =
199-
Option.value ~default:ld.pld_name (ld_attr_json_key ld)
200-
in
201-
let k = estring ~loc:key.loc key.txt in
202-
let v = derive ld.pld_type x in
203-
let ebnds =
204-
match ld_drop_default ld with
205-
| `No -> [%expr ([%e k], [%e v]) :: [%e ebnds]]
206-
| `Drop_option ->
207-
[%expr
208-
match [%e x] with
209-
| Stdlib.Option.None -> [%e ebnds]
210-
| Stdlib.Option.Some _ ->
211-
([%e k], [%e v]) :: [%e ebnds]]
212-
in
213-
[%expr
214-
let [%p pbnds] = [%e ebnds] in
215-
[%e acc]])
198+
let key =
199+
Option.value ~default:ld.pld_name (ld_attr_json_key ld)
200+
in
201+
let k = estring ~loc:key.loc key.txt in
202+
let v = derive ld.pld_type x in
203+
let ebnds =
204+
match ld_drop_default ld with
205+
| `No -> [%expr ([%e k], [%e v]) :: [%e ebnds]]
206+
| `Drop_option ->
207+
[%expr
208+
match [%e x] with
209+
| Stdlib.Option.None -> [%e ebnds]
210+
| Stdlib.Option.Some _ -> ([%e k], [%e v]) :: [%e ebnds]]
211+
in
212+
[%expr
213+
let [%p pbnds] = [%e ebnds] in
214+
[%e acc]])
216215
in
217216
[%expr
218217
`Assoc

0 commit comments

Comments
 (0)