mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-22 03:15:44 +00:00
Format while
Statement (#4810)
This commit is contained in:
parent
d1d06960f0
commit
c65f47d7c4
18 changed files with 555 additions and 145 deletions
|
@ -25,7 +25,6 @@ impl<'a> PyFormatContext<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
pub(crate) fn contents(&self) -> &'a str {
|
||||
self.contents
|
||||
}
|
||||
|
@ -35,7 +34,6 @@ impl<'a> PyFormatContext<'a> {
|
|||
Locator::new(self.contents)
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
pub(crate) fn set_node_level(&mut self, level: NodeLevel) {
|
||||
self.node_level = level;
|
||||
}
|
||||
|
@ -44,7 +42,6 @@ impl<'a> PyFormatContext<'a> {
|
|||
self.node_level
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
pub(crate) fn comments(&self) -> &Comments<'a> {
|
||||
&self.comments
|
||||
}
|
||||
|
@ -80,11 +77,10 @@ pub(crate) enum NodeLevel {
|
|||
#[default]
|
||||
TopLevel,
|
||||
|
||||
/// Formatting nodes that are enclosed by a statement.
|
||||
#[allow(unused)]
|
||||
Statement,
|
||||
/// Formatting the body statements of a [compound statement](https://docs.python.org/3/reference/compound_stmts.html#compound-statements)
|
||||
/// (`if`, `while`, `match`, etc.).
|
||||
CompoundStatement,
|
||||
|
||||
/// Formatting nodes that are enclosed in a parenthesized expression.
|
||||
#[allow(unused)]
|
||||
Parenthesized,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue