Formatter: Run generate.py for ElifElseClauses (#5864)

**Summary** This removes the diff for the next user of `generate.py`.
It's effectively a refactoring.

**Test Plan** No functional changes
This commit is contained in:
konsti 2023-07-18 17:17:17 +02:00 committed by GitHub
parent 0c7c81aa31
commit 5d41c832ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 58 additions and 53 deletions

View file

@ -617,46 +617,6 @@ impl<'ast> IntoFormat<PyFormatContext<'ast>> for ast::StmtIf {
}
}
impl FormatRule<ast::ElifElseClause, PyFormatContext<'_>>
for crate::statement::stmt_if::FormatElifElseClause
{
#[inline]
fn fmt(
&self,
node: &ast::ElifElseClause,
f: &mut Formatter<PyFormatContext<'_>>,
) -> FormatResult<()> {
FormatNodeRule::<ast::ElifElseClause>::fmt(self, node, f)
}
}
impl<'ast> AsFormat<PyFormatContext<'ast>> for ast::ElifElseClause {
type Format<'a> = FormatRefWithRule<
'a,
ast::ElifElseClause,
crate::statement::stmt_if::FormatElifElseClause,
PyFormatContext<'ast>,
>;
fn format(&self) -> Self::Format<'_> {
FormatRefWithRule::new(
self,
crate::statement::stmt_if::FormatElifElseClause::default(),
)
}
}
impl<'ast> IntoFormat<PyFormatContext<'ast>> for ast::ElifElseClause {
type Format = FormatOwnedWithRule<
ast::ElifElseClause,
crate::statement::stmt_if::FormatElifElseClause,
PyFormatContext<'ast>,
>;
fn into_format(self) -> Self::Format {
FormatOwnedWithRule::new(
self,
crate::statement::stmt_if::FormatElifElseClause::default(),
)
}
}
impl FormatRule<ast::StmtWith, PyFormatContext<'_>>
for crate::statement::stmt_with::FormatStmtWith
{
@ -2974,3 +2934,43 @@ impl<'ast> IntoFormat<PyFormatContext<'ast>> for ast::Decorator {
FormatOwnedWithRule::new(self, crate::other::decorator::FormatDecorator::default())
}
}
impl FormatRule<ast::ElifElseClause, PyFormatContext<'_>>
for crate::other::elif_else_clause::FormatElifElseClause
{
#[inline]
fn fmt(
&self,
node: &ast::ElifElseClause,
f: &mut Formatter<PyFormatContext<'_>>,
) -> FormatResult<()> {
FormatNodeRule::<ast::ElifElseClause>::fmt(self, node, f)
}
}
impl<'ast> AsFormat<PyFormatContext<'ast>> for ast::ElifElseClause {
type Format<'a> = FormatRefWithRule<
'a,
ast::ElifElseClause,
crate::other::elif_else_clause::FormatElifElseClause,
PyFormatContext<'ast>,
>;
fn format(&self) -> Self::Format<'_> {
FormatRefWithRule::new(
self,
crate::other::elif_else_clause::FormatElifElseClause::default(),
)
}
}
impl<'ast> IntoFormat<PyFormatContext<'ast>> for ast::ElifElseClause {
type Format = FormatOwnedWithRule<
ast::ElifElseClause,
crate::other::elif_else_clause::FormatElifElseClause,
PyFormatContext<'ast>,
>;
fn into_format(self) -> Self::Format {
FormatOwnedWithRule::new(
self,
crate::other::elif_else_clause::FormatElifElseClause::default(),
)
}
}