@@ -54,7 +54,7 @@ TEST(BuiltAstFmtTest, FormatCastThatNeedsParens) {
5454 const Comments empty_comments = Comments::Create ({});
5555
5656 DocArena arena (file_table);
57- DocRef doc = Fmt (*lt, empty_comments, arena);
57+ DocRef doc = Formatter ( empty_comments, arena). Format (*lt );
5858 EXPECT_EQ (PrettyPrint (arena, doc, /* text_width=*/ 100 ), " (x as t) < x" );
5959}
6060
@@ -63,7 +63,7 @@ TEST(BuiltAstFmtTest, FormatIndexThatNeedsParens) {
6363 const Comments empty_comments = Comments::Create ({});
6464
6565 DocArena arena (file_table);
66- DocRef doc = Fmt (*index, empty_comments, arena);
66+ DocRef doc = Formatter ( empty_comments, arena). Format (*index );
6767 EXPECT_EQ (PrettyPrint (arena, doc, /* text_width=*/ 100 ), " (x as u32[42])[i]" );
6868}
6969
@@ -73,7 +73,7 @@ TEST(BuiltAstFmtTest, FormatTupleIndexThatNeedsParens) {
7373 const Comments empty_comments = Comments::Create ({});
7474
7575 DocArena arena (file_table);
76- DocRef doc = Fmt (*tuple_index, empty_comments, arena);
76+ DocRef doc = Formatter ( empty_comments, arena). Format (*tuple_index );
7777 EXPECT_EQ (PrettyPrint (arena, doc, /* text_width=*/ 100 ), " (x[i]).2" );
7878}
7979
@@ -83,7 +83,7 @@ TEST(BuiltAstFmtTest, FormatSingleElementTuple) {
8383 const Comments empty_comments = Comments::Create ({});
8484
8585 DocArena arena (file_table);
86- DocRef doc = Fmt (*tuple, empty_comments, arena);
86+ DocRef doc = Formatter ( empty_comments, arena). Format (*tuple );
8787 EXPECT_EQ (PrettyPrint (arena, doc, /* text_width=*/ 100 ), " (x0,)" );
8888}
8989
@@ -93,7 +93,7 @@ TEST(BuiltAstFmtTest, FormatShortTupleWithoutTrailingComma) {
9393 const Comments empty_comments = Comments::Create ({});
9494
9595 DocArena arena (file_table);
96- DocRef doc = Fmt (*tuple, empty_comments, arena);
96+ DocRef doc = Formatter ( empty_comments, arena). Format (*tuple );
9797 EXPECT_EQ (PrettyPrint (arena, doc, /* text_width=*/ 100 ), " (x0, x1)" );
9898}
9999
@@ -103,7 +103,7 @@ TEST(BuiltAstFmtTest, FormatShortTupleWithTrailingComma) {
103103 const Comments empty_comments = Comments::Create ({});
104104
105105 DocArena arena (file_table);
106- DocRef doc = Fmt (*tuple, empty_comments, arena);
106+ DocRef doc = Formatter ( empty_comments, arena). Format (*tuple );
107107 EXPECT_EQ (PrettyPrint (arena, doc, /* text_width=*/ 100 ), " (x0, x1)" );
108108}
109109
@@ -114,7 +114,7 @@ TEST(BuiltAstFmtTest, FormatLongTupleShouldAddTrailingComma) {
114114 MakeNElementTupleExpression (40 , /* has_trailing_comma=*/ true );
115115
116116 DocArena arena (file_table);
117- DocRef doc = Fmt (*tuple, empty_comments, arena);
117+ DocRef doc = Formatter ( empty_comments, arena). Format (*tuple );
118118 EXPECT_EQ (PrettyPrint (arena, doc, /* text_width=*/ 100 ),
119119 R"( (
120120 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20,
@@ -127,7 +127,8 @@ TEST(BuiltAstFmtTest, FormatLongTupleShouldAddTrailingComma) {
127127 MakeNElementTupleExpression (40 , /* has_trailing_comma=*/ false );
128128
129129 DocArena arena (file_table);
130- DocRef doc = Fmt (*tuple_without_trailing_comma, empty_comments, arena);
130+ DocRef doc =
131+ Formatter (empty_comments, arena).Format (*tuple_without_trailing_comma);
131132 EXPECT_EQ (PrettyPrint (arena, doc, /* text_width=*/ 100 ),
132133 R"( (
133134 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20,
@@ -141,7 +142,7 @@ TEST(BuiltAstFmtTest, FormatUnopThatNeedsParensOnOperand) {
141142 const Comments empty_comments = Comments::Create ({});
142143
143144 DocArena arena (file_table);
144- DocRef doc = Fmt (*unop, empty_comments, arena);
145+ DocRef doc = Formatter ( empty_comments, arena). Format (*unop );
145146 EXPECT_EQ (PrettyPrint (arena, doc, /* text_width=*/ 100 ), " -(x as u32)" );
146147}
147148
@@ -150,7 +151,7 @@ TEST(BuiltAstFmtTest, FormatAttrThatNeedsParensOnOperand) {
150151 const Comments empty_comments = Comments::Create ({});
151152
152153 DocArena arena (file_table);
153- DocRef doc = Fmt (*attr, empty_comments, arena);
154+ DocRef doc = Formatter ( empty_comments, arena). Format (*attr );
154155 EXPECT_EQ (PrettyPrint (arena, doc, /* text_width=*/ 100 ), " (x * y).my_attr" );
155156}
156157
@@ -181,7 +182,7 @@ TEST(AstFmtTest, FormatVerbatimNodeTop) {
181182 const Comments empty_comments = Comments::Create ({});
182183
183184 DocArena arena (file_table);
184- DocRef doc = Fmt (m, empty_comments, arena);
185+ DocRef doc = Formatter ( empty_comments, arena). Format (m );
185186
186187 // Intentionally small text width, should still be formatted verbatim.
187188 EXPECT_EQ (PrettyPrint (arena, doc, /* text_width=*/ 10 ), verbatim_text);
@@ -233,7 +234,7 @@ class FunctionFmtTest : public testing::Test {
233234 f_, parser_->ParseFunction (Pos (), /* is_public=*/ false , bindings_));
234235 Comments comments = Comments::Create (scanner_->comments ());
235236
236- DocRef doc = Fmt (*f_, comments, arena_);
237+ DocRef doc = Formatter ( comments, arena_). Format (*f_ );
237238 std::string formatted = PrettyPrint (arena_, doc, kDslxDefaultTextWidth );
238239
239240 std::optional<AutoFmtPostconditionViolation> maybe_violation =
0 commit comments