From 9bd284c50d925b6e3b04f90313d4011894d3a19d Mon Sep 17 00:00:00 2001 From: Boris Yakobowski Date: Sat, 4 Jul 2026 12:05:20 +0100 Subject: [PATCH 1/2] test: Add regression tests for comment before `in` in let bindings Add test cases to let_binding.ml covering: - Short comment after value that fits on one line (currently broken across lines regardless of configuration) - Function body with trailing comment (same issue) - Long expression with comment that legitimately needs a break The bug affects all profiles/configurations. Co-Authored-By: Claude Opus 4.6 --- .../let_binding-deindent-fun.ml.ref | 25 +++++++++++++++++++ .../refs.ahrefs/let_binding-in_indent.ml.ref | 25 +++++++++++++++++++ .../refs.ahrefs/let_binding-indent.ml.ref | 25 +++++++++++++++++++ test/passing/refs.ahrefs/let_binding.ml.ref | 25 +++++++++++++++++++ .../let_binding-deindent-fun.ml.ref | 25 +++++++++++++++++++ .../refs.default/let_binding-in_indent.ml.ref | 25 +++++++++++++++++++ .../refs.default/let_binding-indent.ml.ref | 25 +++++++++++++++++++ test/passing/refs.default/let_binding.ml.ref | 25 +++++++++++++++++++ .../let_binding-deindent-fun.ml.ref | 25 +++++++++++++++++++ .../let_binding-in_indent.ml.ref | 25 +++++++++++++++++++ .../refs.janestreet/let_binding-indent.ml.ref | 25 +++++++++++++++++++ .../refs.janestreet/let_binding.ml.ref | 25 +++++++++++++++++++ .../let_binding-deindent-fun.ml.ref | 25 +++++++++++++++++++ .../let_binding-in_indent.ml.ref | 25 +++++++++++++++++++ .../let_binding-indent.ml.ref | 25 +++++++++++++++++++ .../refs.ocamlformat/let_binding.ml.ref | 25 +++++++++++++++++++ test/passing/tests/let_binding.ml | 16 ++++++++++++ 17 files changed, 416 insertions(+) diff --git a/test/passing/refs.ahrefs/let_binding-deindent-fun.ml.ref b/test/passing/refs.ahrefs/let_binding-deindent-fun.ml.ref index c18b84f303..fdff61ee5b 100644 --- a/test/passing/refs.ahrefs/let_binding-deindent-fun.ml.ref +++ b/test/passing/refs.ahrefs/let_binding-deindent-fun.ml.ref @@ -300,3 +300,28 @@ let rewrite_export = let+ (a, b) : a * b = () in () ;; + +(* Comment before in should stay on same line when it fits *) +let () = + let threshold = + 3 + (* max depth *) + in + use threshold +;; + +let () = + let left _ = + true + (* value vs nothing *) + in + use left +;; + +(* Comment before in that does not fit should break *) +let () = + let some_long_variable_name = + some_long_expression_value (* a long comment forcing a break *) + in + use some_long_variable_name +;; diff --git a/test/passing/refs.ahrefs/let_binding-in_indent.ml.ref b/test/passing/refs.ahrefs/let_binding-in_indent.ml.ref index 187c6db1e0..aa1ff49ec0 100644 --- a/test/passing/refs.ahrefs/let_binding-in_indent.ml.ref +++ b/test/passing/refs.ahrefs/let_binding-in_indent.ml.ref @@ -300,3 +300,28 @@ let rewrite_export = let+ (a, b) : a * b = () in () ;; + +(* Comment before in should stay on same line when it fits *) +let () = + let threshold = + 3 + (* max depth *) + in + use threshold +;; + +let () = + let left _ = + true + (* value vs nothing *) + in + use left +;; + +(* Comment before in that does not fit should break *) +let () = + let some_long_variable_name = + some_long_expression_value (* a long comment forcing a break *) + in + use some_long_variable_name +;; diff --git a/test/passing/refs.ahrefs/let_binding-indent.ml.ref b/test/passing/refs.ahrefs/let_binding-indent.ml.ref index 190db884bc..854ff518e7 100644 --- a/test/passing/refs.ahrefs/let_binding-indent.ml.ref +++ b/test/passing/refs.ahrefs/let_binding-indent.ml.ref @@ -300,3 +300,28 @@ let rewrite_export = let+ (a, b) : a * b = () in () ;; + +(* Comment before in should stay on same line when it fits *) +let () = + let threshold = + 3 + (* max depth *) +in + use threshold +;; + +let () = + let left _ = + true + (* value vs nothing *) +in + use left +;; + +(* Comment before in that does not fit should break *) +let () = + let some_long_variable_name = + some_long_expression_value (* a long comment forcing a break *) +in + use some_long_variable_name +;; diff --git a/test/passing/refs.ahrefs/let_binding.ml.ref b/test/passing/refs.ahrefs/let_binding.ml.ref index 10193df68f..36e650646a 100644 --- a/test/passing/refs.ahrefs/let_binding.ml.ref +++ b/test/passing/refs.ahrefs/let_binding.ml.ref @@ -300,3 +300,28 @@ let rewrite_export = let+ (a, b) : a * b = () in () ;; + +(* Comment before in should stay on same line when it fits *) +let () = + let threshold = + 3 + (* max depth *) + in + use threshold +;; + +let () = + let left _ = + true + (* value vs nothing *) + in + use left +;; + +(* Comment before in that does not fit should break *) +let () = + let some_long_variable_name = + some_long_expression_value (* a long comment forcing a break *) + in + use some_long_variable_name +;; diff --git a/test/passing/refs.default/let_binding-deindent-fun.ml.ref b/test/passing/refs.default/let_binding-deindent-fun.ml.ref index db53858100..29926445c6 100644 --- a/test/passing/refs.default/let_binding-deindent-fun.ml.ref +++ b/test/passing/refs.default/let_binding-deindent-fun.ml.ref @@ -273,3 +273,28 @@ let rewrite_export = let+ (a, b) : a * b = () in () ;; + +(* Comment before in should stay on same line when it fits *) +let () = + let threshold = + 3 + (* max depth *) + in + use threshold +;; + +let () = + let left _ = + true + (* value vs nothing *) + in + use left +;; + +(* Comment before in that does not fit should break *) +let () = + let some_long_variable_name = + some_long_expression_value (* a long comment forcing a break *) + in + use some_long_variable_name +;; diff --git a/test/passing/refs.default/let_binding-in_indent.ml.ref b/test/passing/refs.default/let_binding-in_indent.ml.ref index 79a4965be2..3e748a4de7 100644 --- a/test/passing/refs.default/let_binding-in_indent.ml.ref +++ b/test/passing/refs.default/let_binding-in_indent.ml.ref @@ -273,3 +273,28 @@ let rewrite_export = let+ (a, b) : a * b = () in () ;; + +(* Comment before in should stay on same line when it fits *) +let () = + let threshold = + 3 + (* max depth *) + in + use threshold +;; + +let () = + let left _ = + true + (* value vs nothing *) + in + use left +;; + +(* Comment before in that does not fit should break *) +let () = + let some_long_variable_name = + some_long_expression_value (* a long comment forcing a break *) + in + use some_long_variable_name +;; diff --git a/test/passing/refs.default/let_binding-indent.ml.ref b/test/passing/refs.default/let_binding-indent.ml.ref index a302c46bb7..4bdbf2fed6 100644 --- a/test/passing/refs.default/let_binding-indent.ml.ref +++ b/test/passing/refs.default/let_binding-indent.ml.ref @@ -274,3 +274,28 @@ let rewrite_export = let+ (a, b) : a * b = () in () ;; + +(* Comment before in should stay on same line when it fits *) +let () = + let threshold = + 3 + (* max depth *) + in + use threshold +;; + +let () = + let left _ = + true + (* value vs nothing *) + in + use left +;; + +(* Comment before in that does not fit should break *) +let () = + let some_long_variable_name = + some_long_expression_value (* a long comment forcing a break *) + in + use some_long_variable_name +;; diff --git a/test/passing/refs.default/let_binding.ml.ref b/test/passing/refs.default/let_binding.ml.ref index 36fa3c8ca2..7eeb2550da 100644 --- a/test/passing/refs.default/let_binding.ml.ref +++ b/test/passing/refs.default/let_binding.ml.ref @@ -273,3 +273,28 @@ let rewrite_export = let+ (a, b) : a * b = () in () ;; + +(* Comment before in should stay on same line when it fits *) +let () = + let threshold = + 3 + (* max depth *) + in + use threshold +;; + +let () = + let left _ = + true + (* value vs nothing *) + in + use left +;; + +(* Comment before in that does not fit should break *) +let () = + let some_long_variable_name = + some_long_expression_value (* a long comment forcing a break *) + in + use some_long_variable_name +;; diff --git a/test/passing/refs.janestreet/let_binding-deindent-fun.ml.ref b/test/passing/refs.janestreet/let_binding-deindent-fun.ml.ref index 36a7451b80..7800c4d915 100644 --- a/test/passing/refs.janestreet/let_binding-deindent-fun.ml.ref +++ b/test/passing/refs.janestreet/let_binding-deindent-fun.ml.ref @@ -326,3 +326,28 @@ let rewrite_export = let+ (a, b) : a * b = () in () ;; + +(* Comment before in should stay on same line when it fits *) +let () = + let threshold = + 3 + (* max depth *) + in + use threshold +;; + +let () = + let left _ = + true + (* value vs nothing *) + in + use left +;; + +(* Comment before in that does not fit should break *) +let () = + let some_long_variable_name = + some_long_expression_value (* a long comment forcing a break *) + in + use some_long_variable_name +;; diff --git a/test/passing/refs.janestreet/let_binding-in_indent.ml.ref b/test/passing/refs.janestreet/let_binding-in_indent.ml.ref index c1db5a009e..51c21cb282 100644 --- a/test/passing/refs.janestreet/let_binding-in_indent.ml.ref +++ b/test/passing/refs.janestreet/let_binding-in_indent.ml.ref @@ -326,3 +326,28 @@ let rewrite_export = let+ (a, b) : a * b = () in () ;; + +(* Comment before in should stay on same line when it fits *) +let () = + let threshold = + 3 + (* max depth *) + in + use threshold +;; + +let () = + let left _ = + true + (* value vs nothing *) + in + use left +;; + +(* Comment before in that does not fit should break *) +let () = + let some_long_variable_name = + some_long_expression_value (* a long comment forcing a break *) + in + use some_long_variable_name +;; diff --git a/test/passing/refs.janestreet/let_binding-indent.ml.ref b/test/passing/refs.janestreet/let_binding-indent.ml.ref index 61dc7bc0f4..00f6778f27 100644 --- a/test/passing/refs.janestreet/let_binding-indent.ml.ref +++ b/test/passing/refs.janestreet/let_binding-indent.ml.ref @@ -326,3 +326,28 @@ let rewrite_export = let+ (a, b) : a * b = () in () ;; + +(* Comment before in should stay on same line when it fits *) +let () = + let threshold = + 3 + (* max depth *) + in + use threshold +;; + +let () = + let left _ = + true + (* value vs nothing *) + in + use left +;; + +(* Comment before in that does not fit should break *) +let () = + let some_long_variable_name = + some_long_expression_value (* a long comment forcing a break *) + in + use some_long_variable_name +;; diff --git a/test/passing/refs.janestreet/let_binding.ml.ref b/test/passing/refs.janestreet/let_binding.ml.ref index 36a7451b80..7800c4d915 100644 --- a/test/passing/refs.janestreet/let_binding.ml.ref +++ b/test/passing/refs.janestreet/let_binding.ml.ref @@ -326,3 +326,28 @@ let rewrite_export = let+ (a, b) : a * b = () in () ;; + +(* Comment before in should stay on same line when it fits *) +let () = + let threshold = + 3 + (* max depth *) + in + use threshold +;; + +let () = + let left _ = + true + (* value vs nothing *) + in + use left +;; + +(* Comment before in that does not fit should break *) +let () = + let some_long_variable_name = + some_long_expression_value (* a long comment forcing a break *) + in + use some_long_variable_name +;; diff --git a/test/passing/refs.ocamlformat/let_binding-deindent-fun.ml.ref b/test/passing/refs.ocamlformat/let_binding-deindent-fun.ml.ref index 56f710afbf..ff6c61052e 100644 --- a/test/passing/refs.ocamlformat/let_binding-deindent-fun.ml.ref +++ b/test/passing/refs.ocamlformat/let_binding-deindent-fun.ml.ref @@ -300,3 +300,28 @@ let rewrite_export = let+ (a, b) : a * b = () in () ;; + +(* Comment before in should stay on same line when it fits *) +let () = + let threshold = + 3 + (* max depth *) + in + use threshold +;; + +let () = + let left _ = + true + (* value vs nothing *) + in + use left +;; + +(* Comment before in that does not fit should break *) +let () = + let some_long_variable_name = + some_long_expression_value (* a long comment forcing a break *) + in + use some_long_variable_name +;; diff --git a/test/passing/refs.ocamlformat/let_binding-in_indent.ml.ref b/test/passing/refs.ocamlformat/let_binding-in_indent.ml.ref index 105ce4750a..17c626c711 100644 --- a/test/passing/refs.ocamlformat/let_binding-in_indent.ml.ref +++ b/test/passing/refs.ocamlformat/let_binding-in_indent.ml.ref @@ -300,3 +300,28 @@ let rewrite_export = let+ (a, b) : a * b = () in () ;; + +(* Comment before in should stay on same line when it fits *) +let () = + let threshold = + 3 + (* max depth *) + in + use threshold +;; + +let () = + let left _ = + true + (* value vs nothing *) + in + use left +;; + +(* Comment before in that does not fit should break *) +let () = + let some_long_variable_name = + some_long_expression_value (* a long comment forcing a break *) + in + use some_long_variable_name +;; diff --git a/test/passing/refs.ocamlformat/let_binding-indent.ml.ref b/test/passing/refs.ocamlformat/let_binding-indent.ml.ref index 1897d8c16e..e9f5c9c592 100644 --- a/test/passing/refs.ocamlformat/let_binding-indent.ml.ref +++ b/test/passing/refs.ocamlformat/let_binding-indent.ml.ref @@ -301,3 +301,28 @@ let rewrite_export = let+ (a, b) : a * b = () in () ;; + +(* Comment before in should stay on same line when it fits *) +let () = + let threshold = + 3 + (* max depth *) + in + use threshold +;; + +let () = + let left _ = + true + (* value vs nothing *) + in + use left +;; + +(* Comment before in that does not fit should break *) +let () = + let some_long_variable_name = + some_long_expression_value (* a long comment forcing a break *) + in + use some_long_variable_name +;; diff --git a/test/passing/refs.ocamlformat/let_binding.ml.ref b/test/passing/refs.ocamlformat/let_binding.ml.ref index 02d8b1a247..080be00256 100644 --- a/test/passing/refs.ocamlformat/let_binding.ml.ref +++ b/test/passing/refs.ocamlformat/let_binding.ml.ref @@ -300,3 +300,28 @@ let rewrite_export = let+ (a, b) : a * b = () in () ;; + +(* Comment before in should stay on same line when it fits *) +let () = + let threshold = + 3 + (* max depth *) + in + use threshold +;; + +let () = + let left _ = + true + (* value vs nothing *) + in + use left +;; + +(* Comment before in that does not fit should break *) +let () = + let some_long_variable_name = + some_long_expression_value (* a long comment forcing a break *) + in + use some_long_variable_name +;; diff --git a/test/passing/tests/let_binding.ml b/test/passing/tests/let_binding.ml index ab77d849fd..4ff7d7dfd2 100644 --- a/test/passing/tests/let_binding.ml +++ b/test/passing/tests/let_binding.ml @@ -276,3 +276,19 @@ let rewrite_export = let+ (Raw id) : binary indice = () in let+ (a, b) : a * b = () in () + +(* Comment before in should stay on same line when it fits *) +let () = + let threshold = 3 (* max depth *) in + use threshold + +let () = + let left _ = true (* value vs nothing *) in + use left + +(* Comment before in that does not fit should break *) +let () = + let some_long_variable_name = + some_long_expression_value (* a long comment forcing a break *) + in + use some_long_variable_name From 5648b17f300468f0b721513c6ae55111cd9b7715 Mon Sep 17 00:00:00 2001 From: Boris Yakobowski Date: Sat, 4 Jul 2026 12:06:34 +0100 Subject: [PATCH 2/2] Fix comment before `in` forcing unnecessary line break in let bindings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `let x = value (* comment *) in` was being broken across multiple lines regardless of configuration because comments near the `in` keyword were formatted with `force_break` as their prefix, which unconditionally forced the containing hvbox to vertical mode. Fix: change `~pro:force_break` to `~pro:(break 1 0)` in two places in fmt_value_binding — the comment is now a regular break that becomes a space when the hvbox fits horizontally. When the content exceeds the margin, the box still goes vertical naturally. This also fixes a non-idempotency: previously, `let x = v (* c *) in` and its pre-broken equivalent produced different outputs. The bug affects all profiles (default, ocamlformat, janestreet, ahrefs). Co-Authored-By: Claude Opus 4.6 --- lib/Fmt_ast.ml | 4 ++-- .../refs.ahrefs/let_binding-deindent-fun.ml.ref | 10 ++-------- .../passing/refs.ahrefs/let_binding-in_indent.ml.ref | 10 ++-------- test/passing/refs.ahrefs/let_binding-indent.ml.ref | 10 ++-------- test/passing/refs.ahrefs/let_binding.ml.ref | 10 ++-------- test/passing/refs.ahrefs/let_punning-denied.ml.ref | 10 ++-------- .../passing/refs.ahrefs/let_punning-preferred.ml.ref | 8 ++------ test/passing/refs.ahrefs/let_punning.ml.ref | 8 ++------ .../refs.default/let_binding-deindent-fun.ml.ref | 10 ++-------- .../refs.default/let_binding-in_indent.ml.ref | 10 ++-------- test/passing/refs.default/let_binding-indent.ml.ref | 10 ++-------- test/passing/refs.default/let_binding.ml.ref | 10 ++-------- test/passing/refs.default/let_punning-denied.ml.ref | 12 ++---------- .../refs.default/let_punning-preferred.ml.ref | 11 +++-------- test/passing/refs.default/let_punning.ml.ref | 10 ++-------- .../refs.janestreet/let_binding-deindent-fun.ml.ref | 10 ++-------- .../refs.janestreet/let_binding-in_indent.ml.ref | 10 ++-------- .../refs.janestreet/let_binding-indent.ml.ref | 10 ++-------- test/passing/refs.janestreet/let_binding.ml.ref | 10 ++-------- .../refs.janestreet/let_punning-denied.ml.ref | 10 ++-------- .../refs.janestreet/let_punning-preferred.ml.ref | 8 ++------ test/passing/refs.janestreet/let_punning.ml.ref | 8 ++------ .../refs.ocamlformat/let_binding-deindent-fun.ml.ref | 10 ++-------- .../refs.ocamlformat/let_binding-in_indent.ml.ref | 10 ++-------- .../refs.ocamlformat/let_binding-indent.ml.ref | 10 ++-------- test/passing/refs.ocamlformat/let_binding.ml.ref | 10 ++-------- .../refs.ocamlformat/let_punning-denied.ml.ref | 12 ++---------- .../refs.ocamlformat/let_punning-preferred.ml.ref | 11 +++-------- test/passing/refs.ocamlformat/let_punning.ml.ref | 10 ++-------- 29 files changed, 60 insertions(+), 222 deletions(-) diff --git a/lib/Fmt_ast.ml b/lib/Fmt_ast.ml index a136f24f34..dd29565417 100644 --- a/lib/Fmt_ast.ml +++ b/lib/Fmt_ast.ml @@ -4876,7 +4876,7 @@ and fmt_value_binding c ~ctx0 ~rec_flag ?in_ ?epi , fmt_item_attributes c ~pre:(Break (1, 2)) at_at_attrs $ in_ indent , fmt_opt epi , Cmts.fmt_before c lb_loc - , Cmts.fmt_after c lb_loc ~pro:force_break ) + , Cmts.fmt_after c lb_loc ~pro:(break 1 0) ) | None -> let epi = fmt_item_attributes c ~pre:(Break (1, 0)) at_at_attrs $ fmt_opt epi @@ -4955,7 +4955,7 @@ and fmt_value_binding c ~ctx0 ~rec_flag ?in_ ?epi ( hvbox_if toplevel indent decl_and_body $ cmts_after $ opt loc_in - (Cmts.fmt_before c ~pro:force_break ~epi:noop ~eol:noop) ) + (Cmts.fmt_before c ~pro:(break 1 0) ~epi:noop ~eol:noop) ) $ in_ ) $ opt loc_in (Cmts.fmt_after ~pro:force_break c) $ epi ) diff --git a/test/passing/refs.ahrefs/let_binding-deindent-fun.ml.ref b/test/passing/refs.ahrefs/let_binding-deindent-fun.ml.ref index fdff61ee5b..050db807e0 100644 --- a/test/passing/refs.ahrefs/let_binding-deindent-fun.ml.ref +++ b/test/passing/refs.ahrefs/let_binding-deindent-fun.ml.ref @@ -303,18 +303,12 @@ let rewrite_export = (* Comment before in should stay on same line when it fits *) let () = - let threshold = - 3 - (* max depth *) - in + let threshold = 3 (* max depth *) in use threshold ;; let () = - let left _ = - true - (* value vs nothing *) - in + let left _ = true (* value vs nothing *) in use left ;; diff --git a/test/passing/refs.ahrefs/let_binding-in_indent.ml.ref b/test/passing/refs.ahrefs/let_binding-in_indent.ml.ref index aa1ff49ec0..d7d438a3e5 100644 --- a/test/passing/refs.ahrefs/let_binding-in_indent.ml.ref +++ b/test/passing/refs.ahrefs/let_binding-in_indent.ml.ref @@ -303,18 +303,12 @@ let rewrite_export = (* Comment before in should stay on same line when it fits *) let () = - let threshold = - 3 - (* max depth *) - in + let threshold = 3 (* max depth *) in use threshold ;; let () = - let left _ = - true - (* value vs nothing *) - in + let left _ = true (* value vs nothing *) in use left ;; diff --git a/test/passing/refs.ahrefs/let_binding-indent.ml.ref b/test/passing/refs.ahrefs/let_binding-indent.ml.ref index 854ff518e7..19f120ed20 100644 --- a/test/passing/refs.ahrefs/let_binding-indent.ml.ref +++ b/test/passing/refs.ahrefs/let_binding-indent.ml.ref @@ -303,18 +303,12 @@ let rewrite_export = (* Comment before in should stay on same line when it fits *) let () = - let threshold = - 3 - (* max depth *) -in + let threshold = 3 (* max depth *) in use threshold ;; let () = - let left _ = - true - (* value vs nothing *) -in + let left _ = true (* value vs nothing *) in use left ;; diff --git a/test/passing/refs.ahrefs/let_binding.ml.ref b/test/passing/refs.ahrefs/let_binding.ml.ref index 36e650646a..fab45fd893 100644 --- a/test/passing/refs.ahrefs/let_binding.ml.ref +++ b/test/passing/refs.ahrefs/let_binding.ml.ref @@ -303,18 +303,12 @@ let rewrite_export = (* Comment before in should stay on same line when it fits *) let () = - let threshold = - 3 - (* max depth *) - in + let threshold = 3 (* max depth *) in use threshold ;; let () = - let left _ = - true - (* value vs nothing *) - in + let left _ = true (* value vs nothing *) in use left ;; diff --git a/test/passing/refs.ahrefs/let_punning-denied.ml.ref b/test/passing/refs.ahrefs/let_punning-denied.ml.ref index 412c98a4a8..92a1877e55 100644 --- a/test/passing/refs.ahrefs/let_punning-denied.ml.ref +++ b/test/passing/refs.ahrefs/let_punning-denied.ml.ref @@ -22,16 +22,10 @@ let q = let r = let* (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *) - and* (* 5 *) y = - y - (* 6 *) - in + and* (* 5 *) y = y (* 6 *) in x, y let s = let%foo (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *) - and (* 5 *) y = - y - (* 6 *) - in + and (* 5 *) y = y (* 6 *) in x, y diff --git a/test/passing/refs.ahrefs/let_punning-preferred.ml.ref b/test/passing/refs.ahrefs/let_punning-preferred.ml.ref index 29ef0c2a71..ddaa50bf68 100644 --- a/test/passing/refs.ahrefs/let_punning-preferred.ml.ref +++ b/test/passing/refs.ahrefs/let_punning-preferred.ml.ref @@ -26,9 +26,7 @@ let r = (* 3 *) x (* 2 *) (* 4 *) - and* (* 5 *) y - (* 6 *) - in + and* (* 5 *) y (* 6 *) in x, y let s = @@ -37,7 +35,5 @@ let s = (* 3 *) x (* 2 *) (* 4 *) - and (* 5 *) y - (* 6 *) - in + and (* 5 *) y (* 6 *) in x, y diff --git a/test/passing/refs.ahrefs/let_punning.ml.ref b/test/passing/refs.ahrefs/let_punning.ml.ref index 5432ff3fa6..82ee8e3c72 100644 --- a/test/passing/refs.ahrefs/let_punning.ml.ref +++ b/test/passing/refs.ahrefs/let_punning.ml.ref @@ -22,14 +22,10 @@ let q = let r = let* (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *) - and* (* 5 *) y - (* 6 *) - in + and* (* 5 *) y (* 6 *) in x, y let s = let%foo (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *) - and (* 5 *) y - (* 6 *) - in + and (* 5 *) y (* 6 *) in x, y diff --git a/test/passing/refs.default/let_binding-deindent-fun.ml.ref b/test/passing/refs.default/let_binding-deindent-fun.ml.ref index 29926445c6..604e473a2d 100644 --- a/test/passing/refs.default/let_binding-deindent-fun.ml.ref +++ b/test/passing/refs.default/let_binding-deindent-fun.ml.ref @@ -276,18 +276,12 @@ let rewrite_export = (* Comment before in should stay on same line when it fits *) let () = - let threshold = - 3 - (* max depth *) - in + let threshold = 3 (* max depth *) in use threshold ;; let () = - let left _ = - true - (* value vs nothing *) - in + let left _ = true (* value vs nothing *) in use left ;; diff --git a/test/passing/refs.default/let_binding-in_indent.ml.ref b/test/passing/refs.default/let_binding-in_indent.ml.ref index 3e748a4de7..05dac1fbca 100644 --- a/test/passing/refs.default/let_binding-in_indent.ml.ref +++ b/test/passing/refs.default/let_binding-in_indent.ml.ref @@ -276,18 +276,12 @@ let rewrite_export = (* Comment before in should stay on same line when it fits *) let () = - let threshold = - 3 - (* max depth *) - in + let threshold = 3 (* max depth *) in use threshold ;; let () = - let left _ = - true - (* value vs nothing *) - in + let left _ = true (* value vs nothing *) in use left ;; diff --git a/test/passing/refs.default/let_binding-indent.ml.ref b/test/passing/refs.default/let_binding-indent.ml.ref index 4bdbf2fed6..ba4540c756 100644 --- a/test/passing/refs.default/let_binding-indent.ml.ref +++ b/test/passing/refs.default/let_binding-indent.ml.ref @@ -277,18 +277,12 @@ let rewrite_export = (* Comment before in should stay on same line when it fits *) let () = - let threshold = - 3 - (* max depth *) - in + let threshold = 3 (* max depth *) in use threshold ;; let () = - let left _ = - true - (* value vs nothing *) - in + let left _ = true (* value vs nothing *) in use left ;; diff --git a/test/passing/refs.default/let_binding.ml.ref b/test/passing/refs.default/let_binding.ml.ref index 7eeb2550da..dbef21d364 100644 --- a/test/passing/refs.default/let_binding.ml.ref +++ b/test/passing/refs.default/let_binding.ml.ref @@ -276,18 +276,12 @@ let rewrite_export = (* Comment before in should stay on same line when it fits *) let () = - let threshold = - 3 - (* max depth *) - in + let threshold = 3 (* max depth *) in use threshold ;; let () = - let left _ = - true - (* value vs nothing *) - in + let left _ = true (* value vs nothing *) in use left ;; diff --git a/test/passing/refs.default/let_punning-denied.ml.ref b/test/passing/refs.default/let_punning-denied.ml.ref index 061a76aa8e..9f5522bee2 100644 --- a/test/passing/refs.default/let_punning-denied.ml.ref +++ b/test/passing/refs.default/let_punning-denied.ml.ref @@ -14,17 +14,9 @@ let q = (x, y, z) let r = - let* (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *) - and* (* 5 *) y = - y - (* 6 *) - in + let* (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *) and* (* 5 *) y = y (* 6 *) in (x, y) let s = - let%foo (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *) - and (* 5 *) y = - y - (* 6 *) - in + let%foo (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *) and (* 5 *) y = y (* 6 *) in (x, y) diff --git a/test/passing/refs.default/let_punning-preferred.ml.ref b/test/passing/refs.default/let_punning-preferred.ml.ref index d7389534bf..0632a5ab13 100644 --- a/test/passing/refs.default/let_punning-preferred.ml.ref +++ b/test/passing/refs.default/let_punning-preferred.ml.ref @@ -16,12 +16,9 @@ let q = let r = let* (* 1 *) - (* 3 *) x - (* 2 *) + (* 3 *) x (* 2 *) (* 4 *) - and* (* 5 *) y - (* 6 *) - in + and* (* 5 *) y (* 6 *) in (x, y) let s = @@ -30,7 +27,5 @@ let s = (* 3 *) x (* 2 *) (* 4 *) - and (* 5 *) y - (* 6 *) - in + and (* 5 *) y (* 6 *) in (x, y) diff --git a/test/passing/refs.default/let_punning.ml.ref b/test/passing/refs.default/let_punning.ml.ref index 2458e47565..9dbc1a4152 100644 --- a/test/passing/refs.default/let_punning.ml.ref +++ b/test/passing/refs.default/let_punning.ml.ref @@ -14,15 +14,9 @@ let q = (x, y, z) let r = - let* (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *) - and* (* 5 *) y - (* 6 *) - in + let* (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *) and* (* 5 *) y (* 6 *) in (x, y) let s = - let%foo (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *) - and (* 5 *) y - (* 6 *) - in + let%foo (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *) and (* 5 *) y (* 6 *) in (x, y) diff --git a/test/passing/refs.janestreet/let_binding-deindent-fun.ml.ref b/test/passing/refs.janestreet/let_binding-deindent-fun.ml.ref index 7800c4d915..aea933fa9f 100644 --- a/test/passing/refs.janestreet/let_binding-deindent-fun.ml.ref +++ b/test/passing/refs.janestreet/let_binding-deindent-fun.ml.ref @@ -329,18 +329,12 @@ let rewrite_export = (* Comment before in should stay on same line when it fits *) let () = - let threshold = - 3 - (* max depth *) - in + let threshold = 3 (* max depth *) in use threshold ;; let () = - let left _ = - true - (* value vs nothing *) - in + let left _ = true (* value vs nothing *) in use left ;; diff --git a/test/passing/refs.janestreet/let_binding-in_indent.ml.ref b/test/passing/refs.janestreet/let_binding-in_indent.ml.ref index 51c21cb282..af69425dfa 100644 --- a/test/passing/refs.janestreet/let_binding-in_indent.ml.ref +++ b/test/passing/refs.janestreet/let_binding-in_indent.ml.ref @@ -329,18 +329,12 @@ let rewrite_export = (* Comment before in should stay on same line when it fits *) let () = - let threshold = - 3 - (* max depth *) - in + let threshold = 3 (* max depth *) in use threshold ;; let () = - let left _ = - true - (* value vs nothing *) - in + let left _ = true (* value vs nothing *) in use left ;; diff --git a/test/passing/refs.janestreet/let_binding-indent.ml.ref b/test/passing/refs.janestreet/let_binding-indent.ml.ref index 00f6778f27..05f27db82e 100644 --- a/test/passing/refs.janestreet/let_binding-indent.ml.ref +++ b/test/passing/refs.janestreet/let_binding-indent.ml.ref @@ -329,18 +329,12 @@ let rewrite_export = (* Comment before in should stay on same line when it fits *) let () = - let threshold = - 3 - (* max depth *) - in + let threshold = 3 (* max depth *) in use threshold ;; let () = - let left _ = - true - (* value vs nothing *) - in + let left _ = true (* value vs nothing *) in use left ;; diff --git a/test/passing/refs.janestreet/let_binding.ml.ref b/test/passing/refs.janestreet/let_binding.ml.ref index 7800c4d915..aea933fa9f 100644 --- a/test/passing/refs.janestreet/let_binding.ml.ref +++ b/test/passing/refs.janestreet/let_binding.ml.ref @@ -329,18 +329,12 @@ let rewrite_export = (* Comment before in should stay on same line when it fits *) let () = - let threshold = - 3 - (* max depth *) - in + let threshold = 3 (* max depth *) in use threshold ;; let () = - let left _ = - true - (* value vs nothing *) - in + let left _ = true (* value vs nothing *) in use left ;; diff --git a/test/passing/refs.janestreet/let_punning-denied.ml.ref b/test/passing/refs.janestreet/let_punning-denied.ml.ref index f67c2a3c93..fc0e90f4dd 100644 --- a/test/passing/refs.janestreet/let_punning-denied.ml.ref +++ b/test/passing/refs.janestreet/let_punning-denied.ml.ref @@ -21,18 +21,12 @@ let q = let r = let* (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *) - and* (* 5 *) y = - y - (* 6 *) - in + and* (* 5 *) y = y (* 6 *) in x, y ;; let s = let%foo (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *) - and (* 5 *) y = - y - (* 6 *) - in + and (* 5 *) y = y (* 6 *) in x, y ;; diff --git a/test/passing/refs.janestreet/let_punning-preferred.ml.ref b/test/passing/refs.janestreet/let_punning-preferred.ml.ref index 82d3ab7142..9cdde14625 100644 --- a/test/passing/refs.janestreet/let_punning-preferred.ml.ref +++ b/test/passing/refs.janestreet/let_punning-preferred.ml.ref @@ -26,9 +26,7 @@ let r = x (* 2 *) (* 4 *) - and* (* 5 *) y - (* 6 *) - in + and* (* 5 *) y (* 6 *) in x, y ;; @@ -39,8 +37,6 @@ let s = x (* 2 *) (* 4 *) - and (* 5 *) y - (* 6 *) - in + and (* 5 *) y (* 6 *) in x, y ;; diff --git a/test/passing/refs.janestreet/let_punning.ml.ref b/test/passing/refs.janestreet/let_punning.ml.ref index 530d7e3868..9038ec562f 100644 --- a/test/passing/refs.janestreet/let_punning.ml.ref +++ b/test/passing/refs.janestreet/let_punning.ml.ref @@ -21,16 +21,12 @@ let q = let r = let* (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *) - and* (* 5 *) y - (* 6 *) - in + and* (* 5 *) y (* 6 *) in x, y ;; let s = let%foo (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *) - and (* 5 *) y - (* 6 *) - in + and (* 5 *) y (* 6 *) in x, y ;; diff --git a/test/passing/refs.ocamlformat/let_binding-deindent-fun.ml.ref b/test/passing/refs.ocamlformat/let_binding-deindent-fun.ml.ref index ff6c61052e..6308881b56 100644 --- a/test/passing/refs.ocamlformat/let_binding-deindent-fun.ml.ref +++ b/test/passing/refs.ocamlformat/let_binding-deindent-fun.ml.ref @@ -303,18 +303,12 @@ let rewrite_export = (* Comment before in should stay on same line when it fits *) let () = - let threshold = - 3 - (* max depth *) - in + let threshold = 3 (* max depth *) in use threshold ;; let () = - let left _ = - true - (* value vs nothing *) - in + let left _ = true (* value vs nothing *) in use left ;; diff --git a/test/passing/refs.ocamlformat/let_binding-in_indent.ml.ref b/test/passing/refs.ocamlformat/let_binding-in_indent.ml.ref index 17c626c711..bf79ab4c98 100644 --- a/test/passing/refs.ocamlformat/let_binding-in_indent.ml.ref +++ b/test/passing/refs.ocamlformat/let_binding-in_indent.ml.ref @@ -303,18 +303,12 @@ let rewrite_export = (* Comment before in should stay on same line when it fits *) let () = - let threshold = - 3 - (* max depth *) - in + let threshold = 3 (* max depth *) in use threshold ;; let () = - let left _ = - true - (* value vs nothing *) - in + let left _ = true (* value vs nothing *) in use left ;; diff --git a/test/passing/refs.ocamlformat/let_binding-indent.ml.ref b/test/passing/refs.ocamlformat/let_binding-indent.ml.ref index e9f5c9c592..c9d0249d8d 100644 --- a/test/passing/refs.ocamlformat/let_binding-indent.ml.ref +++ b/test/passing/refs.ocamlformat/let_binding-indent.ml.ref @@ -304,18 +304,12 @@ let rewrite_export = (* Comment before in should stay on same line when it fits *) let () = - let threshold = - 3 - (* max depth *) - in + let threshold = 3 (* max depth *) in use threshold ;; let () = - let left _ = - true - (* value vs nothing *) - in + let left _ = true (* value vs nothing *) in use left ;; diff --git a/test/passing/refs.ocamlformat/let_binding.ml.ref b/test/passing/refs.ocamlformat/let_binding.ml.ref index 080be00256..dab5b9b9f0 100644 --- a/test/passing/refs.ocamlformat/let_binding.ml.ref +++ b/test/passing/refs.ocamlformat/let_binding.ml.ref @@ -303,18 +303,12 @@ let rewrite_export = (* Comment before in should stay on same line when it fits *) let () = - let threshold = - 3 - (* max depth *) - in + let threshold = 3 (* max depth *) in use threshold ;; let () = - let left _ = - true - (* value vs nothing *) - in + let left _ = true (* value vs nothing *) in use left ;; diff --git a/test/passing/refs.ocamlformat/let_punning-denied.ml.ref b/test/passing/refs.ocamlformat/let_punning-denied.ml.ref index 192768574f..c1d493076a 100644 --- a/test/passing/refs.ocamlformat/let_punning-denied.ml.ref +++ b/test/passing/refs.ocamlformat/let_punning-denied.ml.ref @@ -17,17 +17,9 @@ let q = (x, y, z) let r = - let* (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *) - and* (* 5 *) y = - y - (* 6 *) - in + let* (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *) and* (* 5 *) y = y (* 6 *) in (x, y) let s = - let%foo (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *) - and (* 5 *) y = - y - (* 6 *) - in + let%foo (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *) and (* 5 *) y = y (* 6 *) in (x, y) diff --git a/test/passing/refs.ocamlformat/let_punning-preferred.ml.ref b/test/passing/refs.ocamlformat/let_punning-preferred.ml.ref index 929a32637f..0a3ef1c5b1 100644 --- a/test/passing/refs.ocamlformat/let_punning-preferred.ml.ref +++ b/test/passing/refs.ocamlformat/let_punning-preferred.ml.ref @@ -19,12 +19,9 @@ let q = let r = let* (* 1 *) - (* 3 *) x - (* 2 *) + (* 3 *) x (* 2 *) (* 4 *) - and* (* 5 *) y - (* 6 *) - in + and* (* 5 *) y (* 6 *) in (x, y) let s = @@ -33,7 +30,5 @@ let s = (* 3 *) x (* 2 *) (* 4 *) - and (* 5 *) y - (* 6 *) - in + and (* 5 *) y (* 6 *) in (x, y) diff --git a/test/passing/refs.ocamlformat/let_punning.ml.ref b/test/passing/refs.ocamlformat/let_punning.ml.ref index feaee6b37c..58a54065dd 100644 --- a/test/passing/refs.ocamlformat/let_punning.ml.ref +++ b/test/passing/refs.ocamlformat/let_punning.ml.ref @@ -17,15 +17,9 @@ let q = (x, y, z) let r = - let* (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *) - and* (* 5 *) y - (* 6 *) - in + let* (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *) and* (* 5 *) y (* 6 *) in (x, y) let s = - let%foo (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *) - and (* 5 *) y - (* 6 *) - in + let%foo (* 1 *) x (* 2 *) = (* 3 *) x (* 4 *) and (* 5 *) y (* 6 *) in (x, y)