Skip to content

Commit d4acfbc

Browse files
improve code quality
1 parent 6758f27 commit d4acfbc

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

lib/Fmt_ast.ml

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2916,21 +2916,18 @@ and fmt_expression c ?(box = true) ?(pro = noop) ?eol ?parens
29162916
$ fmt_atrs
29172917

29182918
and fmt_lazy c ~ctx ?(pro = noop) ~fmt_atrs ~ext ~parens e =
2919-
let lazy_ = str "lazy" $ fmt_extension_suffix c ext in
2920-
match e with
2921-
| {pexp_desc= Pexp_beginend _; _} as e ->
2922-
pro
2923-
$ hvbox 2
2924-
(Params.Exp.wrap c.conf ~parens
2925-
( fmt_expression c ~pro:(lazy_ $ str " ") (sub_exp ~ctx e)
2926-
$ fmt_atrs ) )
2927-
| _ ->
2928-
pro
2929-
$ hvbox 2
2930-
(Params.Exp.wrap c.conf ~parens
2931-
( lazy_ $ space_break
2932-
$ fmt_expression c (sub_exp ~ctx e)
2933-
$ fmt_atrs ) )
2919+
let lazy_ = str "lazy" $ fmt_extension_suffix c ext $ space_break in
2920+
let kw_outer, kw_inner =
2921+
match e.pexp_desc with
2922+
| Pexp_beginend _ -> (noop, lazy_)
2923+
| _ -> (lazy_, noop)
2924+
in
2925+
pro
2926+
$ hvbox 2
2927+
(Params.Exp.wrap c.conf ~parens
2928+
( kw_outer
2929+
$ fmt_expression c ~pro:kw_inner (sub_exp ~ctx e)
2930+
$ fmt_atrs ) )
29342931

29352932
and fmt_beginend c ~loc ?(box = true) ?(pro = noop) ~ctx ~fmt_atrs ~ext
29362933
~indent_wrap ?eol e =
@@ -2962,7 +2959,8 @@ and fmt_beginend c ~loc ?(box = true) ?(pro = noop) ~ctx ~fmt_atrs ~ext
29622959
$ break 1 0 $ end_ )
29632960
| _ ->
29642961
hvbox 0
2965-
( pro $ hvbox 0 begin_ $ break 1 2
2962+
( hvbox 0 (pro $ begin_)
2963+
$ break 1 2
29662964
$ fmt_expression c ~box ?eol ~parens:false ~indent_wrap
29672965
(sub_exp ~ctx e)
29682966
$ force_break $ end_ )

0 commit comments

Comments
 (0)