Skip to content

Commit 813abca

Browse files
committed
reorder args to clause
1 parent c89f9c6 commit 813abca

File tree

10 files changed

+13
-13
lines changed

10 files changed

+13
-13
lines changed

crates/ruff_python_formatter/src/other/except_handler_except_handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ impl FormatNodeRule<ExceptHandlerExceptHandler> for FormatExceptHandlerExceptHan
5757
f,
5858
[clause(
5959
ClauseHeader::ExceptHandler(item),
60-
dangling_comments,
6160
&format_with(|f: &mut PyFormatter| {
6261
write!(
6362
f,
@@ -114,6 +113,7 @@ impl FormatNodeRule<ExceptHandlerExceptHandler> for FormatExceptHandlerExceptHan
114113

115114
Ok(())
116115
}),
116+
dangling_comments,
117117
body,
118118
SuiteKind::other(self.last_suite_in_statement),
119119
)]

crates/ruff_python_formatter/src/other/match_case.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ impl FormatNodeRule<MatchCase> for FormatMatchCase {
4848
f,
4949
[clause(
5050
ClauseHeader::MatchCase(item),
51-
dangling_item_comments,
5251
&format_args![
5352
token("case"),
5453
space(),
5554
maybe_parenthesize_pattern(pattern, item),
5655
format_guard
5756
],
57+
dangling_item_comments,
5858
body,
5959
SuiteKind::other(self.last_suite_in_statement),
6060
)]

crates/ruff_python_formatter/src/statement/clause.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,8 +529,8 @@ impl<'a> FormatClause<'a, '_> {
529529
/// should be suppressed.
530530
pub(crate) fn clause<'a, 'ast, Content>(
531531
header: ClauseHeader<'a>,
532-
trailing_colon_comment: &'a [SourceComment],
533532
header_formatter: &'a Content,
533+
trailing_colon_comment: &'a [SourceComment],
534534
body: &'a Suite,
535535
kind: SuiteKind,
536536
) -> FormatClause<'a, 'ast>

crates/ruff_python_formatter/src/statement/stmt_class_def.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ impl FormatNodeRule<StmtClassDef> for FormatStmtClassDef {
6767
},
6868
clause(
6969
ClauseHeader::Class(item),
70-
trailing_definition_comments,
7170
&format_with(|f| {
7271
write!(f, [token("class"), space(), name.format()])?;
7372

@@ -132,6 +131,7 @@ impl FormatNodeRule<StmtClassDef> for FormatStmtClassDef {
132131

133132
Ok(())
134133
}),
134+
trailing_definition_comments,
135135
body,
136136
SuiteKind::Class,
137137
),

crates/ruff_python_formatter/src/statement/stmt_for.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ impl FormatNodeRule<StmtFor> for FormatStmtFor {
5252
f,
5353
[clause(
5454
ClauseHeader::For(item),
55-
trailing_condition_comments,
5655
&format_args![
5756
is_async.then_some(format_args![token("async"), space()]),
5857
token("for"),
@@ -63,6 +62,7 @@ impl FormatNodeRule<StmtFor> for FormatStmtFor {
6362
space(),
6463
maybe_parenthesize_expression(iter, item, Parenthesize::IfBreaks),
6564
],
65+
trailing_condition_comments,
6666
body,
6767
SuiteKind::other(orelse.is_empty()),
6868
),]
@@ -81,8 +81,8 @@ impl FormatNodeRule<StmtFor> for FormatStmtFor {
8181
f,
8282
[clause(
8383
ClauseHeader::OrElse(ElseClause::For(item)),
84-
trailing,
8584
&token("else"),
85+
trailing,
8686
orelse,
8787
SuiteKind::other(true),
8888
)

crates/ruff_python_formatter/src/statement/stmt_function_def.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ impl FormatNodeRule<StmtFunctionDef> for FormatStmtFunctionDef {
6262
},
6363
clause(
6464
ClauseHeader::Function(item),
65-
trailing_definition_comments,
6665
&format_with(|f| format_function_header(f, item)),
66+
trailing_definition_comments,
6767
body,
6868
SuiteKind::Function,
6969
),

crates/ruff_python_formatter/src/statement/stmt_if.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ impl FormatNodeRule<StmtIf> for FormatStmtIf {
2828
f,
2929
[clause(
3030
ClauseHeader::If(item),
31-
trailing_colon_comment,
3231
&format_args![
3332
token("if"),
3433
space(),
3534
maybe_parenthesize_expression(test, item, Parenthesize::IfBreaks),
3635
],
36+
trailing_colon_comment,
3737
body,
3838
SuiteKind::other(elif_else_clauses.is_empty()),
3939
)]
@@ -78,7 +78,6 @@ pub(crate) fn format_elif_else_clause(
7878
[
7979
clause(
8080
ClauseHeader::ElifElse(item),
81-
trailing_colon_comment,
8281
&format_with(|f: &mut PyFormatter| {
8382
f.options()
8483
.source_map_generation()
@@ -98,6 +97,7 @@ pub(crate) fn format_elif_else_clause(
9897
token("else").fmt(f)
9998
}
10099
}),
100+
trailing_colon_comment,
101101
body,
102102
suite_kind,
103103
)

crates/ruff_python_formatter/src/statement/stmt_try.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ fn format_case<'a>(
156156
f,
157157
[clause(
158158
header,
159-
trailing_case_comments,
160159
&token(kind.keyword()),
160+
trailing_case_comments,
161161
body,
162162
SuiteKind::other(last_suite_in_statement),
163163
)

crates/ruff_python_formatter/src/statement/stmt_while.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ impl FormatNodeRule<StmtWhile> for FormatStmtWhile {
3535
f,
3636
[clause(
3737
ClauseHeader::While(item),
38-
trailing_condition_comments,
3938
&format_args![
4039
token("while"),
4140
space(),
4241
maybe_parenthesize_expression(test, item, Parenthesize::IfBreaks),
4342
],
43+
trailing_condition_comments,
4444
body,
4545
SuiteKind::other(orelse.is_empty()),
4646
)]
@@ -57,8 +57,8 @@ impl FormatNodeRule<StmtWhile> for FormatStmtWhile {
5757
f,
5858
[clause(
5959
ClauseHeader::OrElse(ElseClause::While(item)),
60-
trailing,
6160
&token("else"),
61+
trailing,
6262
orelse,
6363
SuiteKind::other(true),
6464
)

crates/ruff_python_formatter/src/statement/stmt_with.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ impl FormatNodeRule<StmtWith> for FormatStmtWith {
4848
f,
4949
[clause(
5050
ClauseHeader::With(with_stmt),
51-
colon_comments,
5251
&format_with(|f| {
5352
write!(
5453
f,
@@ -140,6 +139,7 @@ impl FormatNodeRule<StmtWith> for FormatStmtWith {
140139
.fmt(f),
141140
}
142141
}),
142+
colon_comments,
143143
&with_stmt.body,
144144
SuiteKind::other(true),
145145
)]

0 commit comments

Comments
 (0)