-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
1 parent
501cca8
commit 1dbfab9
Showing
5 changed files
with
139 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`"); | ||
} | ||
} |