ruff/crates/ruff_python_formatter/src/statement
Charlie Marsh daefa74e9a
Remove async AST node variants for `with`, `for`, and `def` (#6369)
## Summary

Per the suggestion in
https://github.com/astral-sh/ruff/discussions/6183, this PR removes
`AsyncWith`, `AsyncFor`, and `AsyncFunctionDef`, replacing them with an
`is_async` field on the non-async variants of those structs. Unlike an
interpreter, we _generally_ have identical handling for these nodes, so
separating them into distinct variants adds complexity from which we
don't really benefit. This can be seen below, where we get to remove a
_ton_ of code related to adding generic `Any*` wrappers, and a ton of
duplicate branches for these cases.

## Test Plan

`cargo test` is unchanged, apart from parser snapshots.
2023-08-07 16:36:02 +00:00
..
mod.rs Remove async AST node variants for `with`, `for`, and `def` (#6369) 2023-08-07 16:36:02 +00:00
stmt_ann_assign.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_assert.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_assign.rs Replace `Formatter<PyFormatContext<'_>>` with `PyFormatter` (#6330) 2023-08-04 10:48:58 +02:00
stmt_aug_assign.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_break.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_class_def.rs Refactor and rename `skip_trailing_trivia` (#6312) 2023-08-04 13:30:53 +00:00
stmt_continue.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_delete.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_expr.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_for.rs Remove async AST node variants for `with`, `for`, and `def` (#6369) 2023-08-07 16:36:02 +00:00
stmt_function_def.rs Remove async AST node variants for `with`, `for`, and `def` (#6369) 2023-08-07 16:36:02 +00:00
stmt_global.rs Break global and nonlocal statements over continuation lines (#6172) 2023-08-02 19:55:00 +00:00
stmt_if.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_import.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_import_from.rs Preserve end-of-line comments on import-from statements (#6216) 2023-08-01 18:58:05 +00:00
stmt_line_magic.rs Replace `Formatter<PyFormatContext<'_>>` with `PyFormatter` (#6330) 2023-08-04 10:48:58 +02:00
stmt_match.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_nonlocal.rs Break global and nonlocal statements over continuation lines (#6172) 2023-08-02 19:55:00 +00:00
stmt_pass.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_raise.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_return.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_try.rs Replace `Formatter<PyFormatContext<'_>>` with `PyFormatter` (#6330) 2023-08-04 10:48:58 +02:00
stmt_try_star.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_type_alias.rs Add formatting of type alias statements (#6162) 2023-08-02 20:40:32 +00:00
stmt_while.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_with.rs Remove async AST node variants for `with`, `for`, and `def` (#6369) 2023-08-07 16:36:02 +00:00
suite.rs Remove async AST node variants for `with`, `for`, and `def` (#6369) 2023-08-07 16:36:02 +00:00