mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-21 19:05:09 +00:00
Remove Stmt::TryStar
(#6566)
## Summary Instead, we set an `is_star` flag on `Stmt::Try`. This is similar to the pattern we've migrated towards for `Stmt::For` (removing `Stmt::AsyncFor`) and friends. While these are significant differences for an interpreter, we tend to handle these cases identically or nearly identically. ## Test Plan `cargo test`
This commit is contained in:
parent
09c8b17661
commit
96d310fbab
33 changed files with 70 additions and 489 deletions
|
@ -582,42 +582,6 @@ impl<'ast> IntoFormat<PyFormatContext<'ast>> for ast::StmtTry {
|
|||
}
|
||||
}
|
||||
|
||||
impl FormatRule<ast::StmtTryStar, PyFormatContext<'_>>
|
||||
for crate::statement::stmt_try_star::FormatStmtTryStar
|
||||
{
|
||||
#[inline]
|
||||
fn fmt(&self, node: &ast::StmtTryStar, f: &mut PyFormatter) -> FormatResult<()> {
|
||||
FormatNodeRule::<ast::StmtTryStar>::fmt(self, node, f)
|
||||
}
|
||||
}
|
||||
impl<'ast> AsFormat<PyFormatContext<'ast>> for ast::StmtTryStar {
|
||||
type Format<'a> = FormatRefWithRule<
|
||||
'a,
|
||||
ast::StmtTryStar,
|
||||
crate::statement::stmt_try_star::FormatStmtTryStar,
|
||||
PyFormatContext<'ast>,
|
||||
>;
|
||||
fn format(&self) -> Self::Format<'_> {
|
||||
FormatRefWithRule::new(
|
||||
self,
|
||||
crate::statement::stmt_try_star::FormatStmtTryStar::default(),
|
||||
)
|
||||
}
|
||||
}
|
||||
impl<'ast> IntoFormat<PyFormatContext<'ast>> for ast::StmtTryStar {
|
||||
type Format = FormatOwnedWithRule<
|
||||
ast::StmtTryStar,
|
||||
crate::statement::stmt_try_star::FormatStmtTryStar,
|
||||
PyFormatContext<'ast>,
|
||||
>;
|
||||
fn into_format(self) -> Self::Format {
|
||||
FormatOwnedWithRule::new(
|
||||
self,
|
||||
crate::statement::stmt_try_star::FormatStmtTryStar::default(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl FormatRule<ast::StmtAssert, PyFormatContext<'_>>
|
||||
for crate::statement::stmt_assert::FormatStmtAssert
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue