@@ -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
@@ -2738,8 +2738,8 @@ and fmt_expression c ?(box = true) ?(pro = noop) ?eol ?parens
27382738 ( fmt_pattern c ~pro: (if_newline " | " )
27392739 (sub_pat ~ctx pc_lhs)
27402740 $ opt pc_guard (fun g ->
2741- space_break $ str " when "
2742- $ fmt_expression c (sub_exp ~ctx g) )
2741+ space_break $ str " when "
2742+ $ fmt_expression c (sub_exp ~ctx g) )
27432743 $ space_break $ str " ->"
27442744 $ fmt_if parens_here (str " (" ) ) )
27452745 $ break 1 2
@@ -3049,10 +3049,9 @@ and fmt_lazy c ~ctx ?(pro = noop) ~fmt_atrs ~infix_ext_attrs ~parens e =
30493049and fmt_beginend c ~loc ?(box = true ) ?(pro = noop) ~ctx ~ctx0 ~fmt_atrs
30503050 ~infix_ext_attrs ~indent_wrap ?eol e =
30513051 let cmts_before = Cmts. fmt_before c ?eol loc in
3052- let begin_ = fmt_infix_ext_attrs c ~pro: (str " begin" ) infix_ext_attrs
3053- and end_ =
3054- (if not box then break 1000 (- 2 ) else break 1000 0 )
3055- $ str " end" $ fmt_atrs
3052+ let begin_ = fmt_infix_ext_attrs c ~pro: (str " begin" ) infix_ext_attrs in
3053+ let end_ =
3054+ (if not box then break 1000 (- 2 ) else break 1 0 ) $ str " end" $ fmt_atrs
30563055 in
30573056 let box_beginend_sb = Params.Exp. box_beginend_subexpr c.conf ~ctx ~ctx0 in
30583057 let beginend_box =
@@ -3446,8 +3445,8 @@ and fmt_case c ctx ~first ~last case =
34463445 ( hvbox 0
34473446 ( fmt_pattern c ~pro: p.bar ~parens: paren_lhs xlhs
34483447 $ opt pc_guard (fun g ->
3449- break 1 2 $ str " when " $ fmt_expression c (sub_exp ~ctx g) )
3450- )
3448+ break 1 2 $ str " when "
3449+ $ fmt_expression c (sub_exp ~ctx g) ) )
34513450 $ p.break_before_arrow $ str " ->" $ p.break_after_arrow
34523451 $ p.open_paren_branch )
34533452 $ p.break_after_opening_paren
@@ -3783,9 +3782,9 @@ and fmt_type_extension c ctx
37833782 $ str " +="
37843783 $ fmt_private_flag c ptyext_private
37853784 $ list_fl ptyext_constructors (fun ~first ~last :_ x ->
3786- let bar_fits = if first then " " else " | " in
3787- cbreak ~fits: (" " , 1 , bar_fits) ~breaks: (" " , 0 , " | " )
3788- $ fmt_ctor x ) )
3785+ let bar_fits = if first then " " else " | " in
3786+ cbreak ~fits: (" " , 1 , bar_fits) ~breaks: (" " , 0 , " | " )
3787+ $ fmt_ctor x ) )
37893788 $ fmt_item_attributes c ~pre: (Break (1 , 0 )) attrs_after )
37903789
37913790and fmt_type_exception ~pre c ctx
@@ -4106,46 +4105,46 @@ and fmt_class_types c ~pre ~sep cls =
41064105and fmt_class_exprs c cls =
41074106 hvbox 0
41084107 @@ list_fl cls (fun ~first ~last :_ cl ->
4109- update_config_maybe_disabled_attrs c cl.pci_loc cl.pci_attributes
4110- @@ fun c ->
4111- let ctx = Cd cl in
4112- let xargs = cl.pci_args in
4113- let ext = cl.pci_attributes.attrs_extension in
4114- let doc_before, doc_after, attrs_before, attrs_after =
4115- let force_before = not (Cl. is_simple cl.pci_expr) in
4116- fmt_docstring_around_item_attrs ~force_before c cl.pci_attributes
4117- in
4118- let class_expr =
4119- let pro =
4120- box_fun_decl_args c 2
4121- ( hovbox 2
4122- ( str (if first then " class" else " and" )
4123- $ fmt_if first (fmt_extension_suffix c ext)
4124- $ fmt_attributes c ~pre: (Break (1 , 0 )) attrs_before
4125- $ fmt_virtual_flag c cl.pci_virt
4126- $ space_break
4127- $ fmt_class_params c ctx cl.pci_params
4128- $ fmt_str_loc c cl.pci_name )
4129- $ fmt_if (not (List. is_empty xargs)) space_break
4130- $ wrap_fun_decl_args c (fmt_class_fun_args c xargs) )
4131- in
4132- let intro =
4133- match cl.pci_constraint with
4134- | Some ty ->
4135- fmt_class_type c
4136- ~pro: (pro $ str " :" $ space_break)
4137- (sub_cty ~ctx ty)
4138- | None -> pro
4139- in
4140- hovbox 2
4141- ( hovbox 2 (intro $ space_break $ str " =" )
4142- $ space_break
4143- $ fmt_class_expr c (sub_cl ~ctx cl.pci_expr) )
4144- $ fmt_item_attributes c ~pre: (Break (1 , 0 )) attrs_after
4145- in
4146- fmt_if (not first) (str " \n " $ force_break)
4147- $ hovbox 0
4148- @@ Cmts. fmt c cl.pci_loc (doc_before $ class_expr $ doc_after) )
4108+ update_config_maybe_disabled_attrs c cl.pci_loc cl.pci_attributes
4109+ @@ fun c ->
4110+ let ctx = Cd cl in
4111+ let xargs = cl.pci_args in
4112+ let ext = cl.pci_attributes.attrs_extension in
4113+ let doc_before, doc_after, attrs_before, attrs_after =
4114+ let force_before = not (Cl. is_simple cl.pci_expr) in
4115+ fmt_docstring_around_item_attrs ~force_before c cl.pci_attributes
4116+ in
4117+ let class_expr =
4118+ let pro =
4119+ box_fun_decl_args c 2
4120+ ( hovbox 2
4121+ ( str (if first then " class" else " and" )
4122+ $ fmt_if first (fmt_extension_suffix c ext)
4123+ $ fmt_attributes c ~pre: (Break (1 , 0 )) attrs_before
4124+ $ fmt_virtual_flag c cl.pci_virt
4125+ $ space_break
4126+ $ fmt_class_params c ctx cl.pci_params
4127+ $ fmt_str_loc c cl.pci_name )
4128+ $ fmt_if (not (List. is_empty xargs)) space_break
4129+ $ wrap_fun_decl_args c (fmt_class_fun_args c xargs) )
4130+ in
4131+ let intro =
4132+ match cl.pci_constraint with
4133+ | Some ty ->
4134+ fmt_class_type c
4135+ ~pro: (pro $ str " :" $ space_break)
4136+ (sub_cty ~ctx ty)
4137+ | None -> pro
4138+ in
4139+ hovbox 2
4140+ ( hovbox 2 (intro $ space_break $ str " =" )
4141+ $ space_break
4142+ $ fmt_class_expr c (sub_cl ~ctx cl.pci_expr) )
4143+ $ fmt_item_attributes c ~pre: (Break (1 , 0 )) attrs_after
4144+ in
4145+ fmt_if (not first) (str " \n " $ force_break)
4146+ $ hovbox 0
4147+ @@ Cmts. fmt c cl.pci_loc (doc_before $ class_expr $ doc_after) )
41494148
41504149and fmt_module c ctx ?rec_ ?epi ?(can_sparse = false ) keyword ?(eqty = " =" )
41514150 name xargs xbody xmty ~attrs ~rec_flag =
@@ -4243,13 +4242,13 @@ and fmt_module c ctx ?rec_ ?epi ?(can_sparse = false) keyword ?(eqty = "=")
42434242 $ fmt_item_attributes c ~pre: (Break (1 , 0 )) attrs_after
42444243 $ doc_after
42454244 $ opt epi (fun epi ->
4246- fmt_or compact
4247- (fmt_or
4248- ( Option. is_some blk_b.epi
4249- && not c.conf.fmt_opts.ocp_indent_compat.v )
4250- (str " " ) space_break )
4251- (break 1 (- 2 ))
4252- $ epi ) )
4245+ fmt_or compact
4246+ (fmt_or
4247+ ( Option. is_some blk_b.epi
4248+ && not c.conf.fmt_opts.ocp_indent_compat.v )
4249+ (str " " ) space_break )
4250+ (break 1 (- 2 ))
4251+ $ epi ) )
42534252
42544253and fmt_module_declaration c ~rec_flag ~first {ast = pmd ; _} =
42554254 protect c (Md pmd)
0 commit comments