mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-23 04:55:21 +00:00

* Generate FormatRule definitions * Generate verbatim output * pub(crate) everything * clippy fix * Update crates/ruff_python_formatter/src/lib.rs Co-authored-by: Micha Reiser <micha@reiser.io> * Update crates/ruff_python_formatter/src/lib.rs Co-authored-by: Micha Reiser <micha@reiser.io> * stub out with Ok(()) again * Update crates/ruff_python_formatter/src/lib.rs Co-authored-by: Micha Reiser <micha@reiser.io> * PyFormatContext::{contents, locator} with `#[allow(unused)]` * Can't leak private type * remove commented code * Fix ruff errors * pub struct Format{node} due to rust rules --------- Co-authored-by: Julian LaNeve <lanevejulian@gmail.com> Co-authored-by: Micha Reiser <micha@reiser.io>
466 B
466 B
Rust Python Formatter
For the formatter, we would like to implement Format
from the rust_formatter crate for all AST
nodes, defined in the rustpython_parser crate. This violates rust's orphan rules. We therefore
generate in generate.py
a newtype for each AST node with implementations of FormatNodeRule
,
FormatRule
, AsFormat
and IntoFormat
on it.