@@ -222,10 +222,10 @@ let fmt_item_list c ctx0 update_config ast fmt_item items =
222222 let loc = Ast. location ctx in
223223 maybe_disabled c loc [] (fun c -> fmt_item c ctx ~prev ~next itm)
224224 $ opt next (fun (i_n , c_n ) ->
225- fmt_or
226- (break_between c (ctx, c.conf) (ast i_n, c_n.conf))
227- (str " \n " $ force_break)
228- (fmt_or break_struct force_break space_break) )
225+ fmt_or
226+ (break_between c (ctx, c.conf) (ast i_n, c_n.conf))
227+ (str " \n " $ force_break)
228+ (fmt_or break_struct force_break space_break) )
229229
230230let fmt_recmodule c ctx items fmt_item ast sub =
231231 let update_config c i = update_config c (Ast. attributes (ast i)) in
@@ -473,7 +473,7 @@ let fmt_docstring_around_item' ?(is_val = false) ?(force_before = false)
473473 let floating_doc, doc =
474474 doc
475475 |> List. map ~f: (fun (({txt; loc} , _ ) as doc ) ->
476- (Docstring. parse ~loc txt, doc) )
476+ (Docstring. parse ~loc txt, doc) )
477477 |> List. partition_tf ~f: (fun (_ , (_ , floating )) -> floating)
478478 in
479479 let placement =
@@ -860,8 +860,8 @@ and fmt_core_type c ?(box = true) ?pro ?(pro_space = true) ?constraint_ctx
860860 update_config_maybe_disabled c ptyp_loc ptyp_attributes
861861 @@ fun c ->
862862 ( match pro with
863- | Some pro -> fmt_constraint_sep ~pro_space c pro
864- | None -> noop )
863+ | Some pro -> fmt_constraint_sep ~pro_space c pro
864+ | None -> noop )
865865 $
866866 let doc, atrs = doc_atrs ptyp_attributes in
867867 Cmts. fmt c ptyp_loc
@@ -1131,8 +1131,8 @@ and fmt_pattern ?ext c ?pro ?parens ?(box = false)
11311131 let parens = match parens with Some b -> b | None -> parenze_pat xpat in
11321132 (match ctx0 with Pat {ppat_desc = Ppat_tuple _ ; _} -> hvbox 0 | _ -> Fn. id)
11331133 @@ ( match ppat_desc with
1134- | Ppat_or _ -> fun k -> Cmts. fmt c ppat_loc @@ k
1135- | _ -> fun k -> Cmts. fmt c ppat_loc @@ (fmt_opt pro $ k) )
1134+ | Ppat_or _ -> fun k -> Cmts. fmt c ppat_loc @@ k
1135+ | _ -> fun k -> Cmts. fmt c ppat_loc @@ (fmt_opt pro $ k) )
11361136 @@ hovbox_if box 0
11371137 @@ fmt_pattern_attributes c xpat
11381138 @@
@@ -1533,7 +1533,7 @@ and fmt_indexop_access c ctx ~fmt_atrs ~has_attr ~parens x =
15331533 (str " ;" $ space_break)
15341534 (sub_exp ~ctx >> fmt_expression c) ) )
15351535 $ opt pia_rhs (fun e ->
1536- fmt_assign_arrow c $ fmt_expression c (sub_exp ~ctx e) ) )
1536+ fmt_assign_arrow c $ fmt_expression c (sub_exp ~ctx e) ) )
15371537 $ fmt_atrs ) )
15381538
15391539(* * Format a [Pexp_function]. [wrap_intro] wraps up to after the [->] and is
@@ -2740,8 +2740,8 @@ and fmt_expression c ?(box = true) ?(pro = noop) ?eol ?parens
27402740 ( fmt_pattern c ~pro: (if_newline " | " )
27412741 (sub_pat ~ctx pc_lhs)
27422742 $ opt pc_guard (fun g ->
2743- space_break $ str " when "
2744- $ fmt_expression c (sub_exp ~ctx g) )
2743+ space_break $ str " when "
2744+ $ fmt_expression c (sub_exp ~ctx g) )
27452745 $ space_break $ str " ->"
27462746 $ fmt_if parens_here (str " (" ) ) )
27472747 $ break 1 2
@@ -3051,10 +3051,9 @@ and fmt_lazy c ~ctx ?(pro = noop) ~fmt_atrs ~infix_ext_attrs ~parens e =
30513051and fmt_beginend c ~loc ?(box = true ) ?(pro = noop) ~ctx ~ctx0 ~fmt_atrs
30523052 ~infix_ext_attrs ~indent_wrap ?eol e =
30533053 let cmts_before = Cmts. fmt_before c ?eol loc in
3054- let begin_ = fmt_infix_ext_attrs c ~pro: (str " begin" ) infix_ext_attrs
3055- and end_ =
3056- (if not box then break 1000 (- 2 ) else break 1000 0 )
3057- $ str " end" $ fmt_atrs
3054+ let begin_ = fmt_infix_ext_attrs c ~pro: (str " begin" ) infix_ext_attrs in
3055+ let end_ =
3056+ (if not box then break 1000 (- 2 ) else break 1 0 ) $ str " end" $ fmt_atrs
30583057 in
30593058 let box_beginend_sb = Params.Exp. box_beginend_subexpr c.conf ~ctx ~ctx0 in
30603059 let beginend_box =
@@ -3448,8 +3447,8 @@ and fmt_case c ctx ~first ~last case =
34483447 ( hvbox 0
34493448 ( fmt_pattern c ~pro: p.bar ~parens: paren_lhs xlhs
34503449 $ opt pc_guard (fun g ->
3451- break 1 2 $ str " when " $ fmt_expression c (sub_exp ~ctx g) )
3452- )
3450+ break 1 2 $ str " when "
3451+ $ fmt_expression c (sub_exp ~ctx g) ) )
34533452 $ p.break_before_arrow $ str " ->" $ p.break_after_arrow
34543453 $ p.open_paren_branch )
34553454 $ p.break_after_opening_paren
@@ -3785,9 +3784,9 @@ and fmt_type_extension c ctx
37853784 $ str " +="
37863785 $ fmt_private_flag c ptyext_private
37873786 $ list_fl ptyext_constructors (fun ~first ~last :_ x ->
3788- let bar_fits = if first then " " else " | " in
3789- cbreak ~fits: (" " , 1 , bar_fits) ~breaks: (" " , 0 , " | " )
3790- $ fmt_ctor x ) )
3787+ let bar_fits = if first then " " else " | " in
3788+ cbreak ~fits: (" " , 1 , bar_fits) ~breaks: (" " , 0 , " | " )
3789+ $ fmt_ctor x ) )
37913790 $ fmt_item_attributes c ~pre: (Break (1 , 0 )) attrs_after )
37923791
37933792and fmt_type_exception ~pre c ctx
@@ -4127,46 +4126,46 @@ and fmt_class_types c ~pre ~sep cls =
41274126and fmt_class_exprs c cls =
41284127 hvbox 0
41294128 @@ list_fl cls (fun ~first ~last :_ cl ->
4130- update_config_maybe_disabled_attrs c cl.pci_loc cl.pci_attributes
4131- @@ fun c ->
4132- let ctx = Cd cl in
4133- let xargs = cl.pci_args in
4134- let ext = cl.pci_attributes.attrs_extension in
4135- let doc_before, doc_after, attrs_before, attrs_after =
4136- let force_before = not (Cl. is_simple cl.pci_expr) in
4137- fmt_docstring_around_item_attrs ~force_before c cl.pci_attributes
4138- in
4139- let class_expr =
4140- let pro =
4141- box_fun_decl_args c 2
4142- ( hovbox 2
4143- ( str (if first then " class" else " and" )
4144- $ fmt_if first (fmt_extension_suffix c ext)
4145- $ fmt_attributes c ~pre: (Break (1 , 0 )) attrs_before
4146- $ fmt_virtual_flag c cl.pci_virt
4147- $ space_break
4148- $ fmt_class_params c ctx cl.pci_params
4149- $ fmt_str_loc c cl.pci_name )
4150- $ fmt_if (not (List. is_empty xargs)) space_break
4151- $ wrap_fun_decl_args c (fmt_class_fun_args c xargs) )
4152- in
4153- let intro =
4154- match cl.pci_constraint with
4155- | Some ty ->
4156- fmt_class_type c
4157- ~pro: (pro $ str " :" $ space_break)
4158- (sub_cty ~ctx ty)
4159- | None -> pro
4160- in
4161- hovbox 2
4162- ( hovbox 2 (intro $ space_break $ str " =" )
4163- $ space_break
4164- $ fmt_class_expr c (sub_cl ~ctx cl.pci_expr) )
4165- $ fmt_item_attributes c ~pre: (Break (1 , 0 )) attrs_after
4166- in
4167- fmt_if (not first) (str " \n " $ force_break)
4168- $ hovbox 0
4169- @@ Cmts. fmt c cl.pci_loc (doc_before $ class_expr $ doc_after) )
4129+ update_config_maybe_disabled_attrs c cl.pci_loc cl.pci_attributes
4130+ @@ fun c ->
4131+ let ctx = Cd cl in
4132+ let xargs = cl.pci_args in
4133+ let ext = cl.pci_attributes.attrs_extension in
4134+ let doc_before, doc_after, attrs_before, attrs_after =
4135+ let force_before = not (Cl. is_simple cl.pci_expr) in
4136+ fmt_docstring_around_item_attrs ~force_before c cl.pci_attributes
4137+ in
4138+ let class_expr =
4139+ let pro =
4140+ box_fun_decl_args c 2
4141+ ( hovbox 2
4142+ ( str (if first then " class" else " and" )
4143+ $ fmt_if first (fmt_extension_suffix c ext)
4144+ $ fmt_attributes c ~pre: (Break (1 , 0 )) attrs_before
4145+ $ fmt_virtual_flag c cl.pci_virt
4146+ $ space_break
4147+ $ fmt_class_params c ctx cl.pci_params
4148+ $ fmt_str_loc c cl.pci_name )
4149+ $ fmt_if (not (List. is_empty xargs)) space_break
4150+ $ wrap_fun_decl_args c (fmt_class_fun_args c xargs) )
4151+ in
4152+ let intro =
4153+ match cl.pci_constraint with
4154+ | Some ty ->
4155+ fmt_class_type c
4156+ ~pro: (pro $ str " :" $ space_break)
4157+ (sub_cty ~ctx ty)
4158+ | None -> pro
4159+ in
4160+ hovbox 2
4161+ ( hovbox 2 (intro $ space_break $ str " =" )
4162+ $ space_break
4163+ $ fmt_class_expr c (sub_cl ~ctx cl.pci_expr) )
4164+ $ fmt_item_attributes c ~pre: (Break (1 , 0 )) attrs_after
4165+ in
4166+ fmt_if (not first) (str " \n " $ force_break)
4167+ $ hovbox 0
4168+ @@ Cmts. fmt c cl.pci_loc (doc_before $ class_expr $ doc_after) )
41704169
41714170and fmt_module c ctx ?rec_ ?epi ?(can_sparse = false ) keyword ?(eqty = " =" )
41724171 name xargs xbody xmty ~attrs ~rec_flag =
@@ -4277,13 +4276,13 @@ and fmt_module c ctx ?rec_ ?epi ?(can_sparse = false) keyword ?(eqty = "=")
42774276 $ fmt_item_attributes c ~pre: (Break (1 , 0 )) attrs_after
42784277 $ doc_after
42794278 $ opt epi (fun epi ->
4280- fmt_or compact
4281- (fmt_or
4282- ( Option. is_some blk_b.epi
4283- && not c.conf.fmt_opts.ocp_indent_compat.v )
4284- (str " " ) space_break )
4285- (break 1 (- 2 ))
4286- $ epi ) )
4279+ fmt_or compact
4280+ (fmt_or
4281+ ( Option. is_some blk_b.epi
4282+ && not c.conf.fmt_opts.ocp_indent_compat.v )
4283+ (str " " ) space_break )
4284+ (break 1 (- 2 ))
4285+ $ epi ) )
42874286
42884287and fmt_module_declaration c ~rec_flag ~first {ast = pmd ; _} =
42894288 protect c (Md pmd)
0 commit comments