mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 04:45:01 +00:00
Auto-generate formatter nodes for string parts (#8837)
A follow-up to auto-generate the `FormatNodeRule` implementation for the string part nodes. This is just a dummy implementation that is unreachable because it's handled by the parent nodes.
This commit is contained in:
parent
501cca8b72
commit
1dbfab9a0c
5 changed files with 139 additions and 0 deletions
12
crates/ruff_python_formatter/src/other/bytes_literal.rs
Normal file
12
crates/ruff_python_formatter/src/other/bytes_literal.rs
Normal file
|
@ -0,0 +1,12 @@
|
|||
use ruff_python_ast::BytesLiteral;
|
||||
|
||||
use crate::prelude::*;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatBytesLiteral;
|
||||
|
||||
impl FormatNodeRule<BytesLiteral> for FormatBytesLiteral {
|
||||
fn fmt_fields(&self, _item: &BytesLiteral, _f: &mut PyFormatter) -> FormatResult<()> {
|
||||
unreachable!("Handled inside of `FormatExprBytesLiteral`");
|
||||
}
|
||||
}
|
12
crates/ruff_python_formatter/src/other/f_string.rs
Normal file
12
crates/ruff_python_formatter/src/other/f_string.rs
Normal file
|
@ -0,0 +1,12 @@
|
|||
use ruff_python_ast::FString;
|
||||
|
||||
use crate::prelude::*;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatFString;
|
||||
|
||||
impl FormatNodeRule<FString> for FormatFString {
|
||||
fn fmt_fields(&self, _item: &FString, _f: &mut PyFormatter) -> FormatResult<()> {
|
||||
unreachable!("Handled inside of `FormatExprFString`");
|
||||
}
|
||||
}
|
|
@ -1,14 +1,17 @@
|
|||
pub(crate) mod alias;
|
||||
pub(crate) mod arguments;
|
||||
pub(crate) mod bytes_literal;
|
||||
pub(crate) mod commas;
|
||||
pub(crate) mod comprehension;
|
||||
pub(crate) mod decorator;
|
||||
pub(crate) mod elif_else_clause;
|
||||
pub(crate) mod except_handler_except_handler;
|
||||
pub(crate) mod f_string;
|
||||
pub(crate) mod identifier;
|
||||
pub(crate) mod keyword;
|
||||
pub(crate) mod match_case;
|
||||
pub(crate) mod parameter;
|
||||
pub(crate) mod parameter_with_default;
|
||||
pub(crate) mod parameters;
|
||||
pub(crate) mod string_literal;
|
||||
pub(crate) mod with_item;
|
||||
|
|
12
crates/ruff_python_formatter/src/other/string_literal.rs
Normal file
12
crates/ruff_python_formatter/src/other/string_literal.rs
Normal file
|
@ -0,0 +1,12 @@
|
|||
use ruff_python_ast::StringLiteral;
|
||||
|
||||
use crate::prelude::*;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct FormatStringLiteral;
|
||||
|
||||
impl FormatNodeRule<StringLiteral> for FormatStringLiteral {
|
||||
fn fmt_fields(&self, _item: &StringLiteral, _f: &mut PyFormatter) -> FormatResult<()> {
|
||||
unreachable!("Handled inside of `FormatExprStringLiteral`");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue