mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-16 08:30:16 +00:00
Split implicit concatenated strings before binary expressions (#7145)
This commit is contained in:
parent
9671922e40
commit
e376c3ff7e
20 changed files with 1067 additions and 366 deletions
|
@ -89,7 +89,11 @@ pub enum StringLayout {
|
|||
#[default]
|
||||
Default,
|
||||
DocString,
|
||||
ImplicitConcatenatedBinaryLeftSide,
|
||||
/// An implicit concatenated string in a binary like (e.g. `a + b` or `a < b`) expression.
|
||||
///
|
||||
/// Formats the implicit concatenated string parts without the enclosing group because the group
|
||||
/// is added by the binary like formatting.
|
||||
ImplicitConcatenatedStringInBinaryLike,
|
||||
}
|
||||
|
||||
impl<'a> FormatString<'a> {
|
||||
|
@ -135,7 +139,7 @@ impl<'a> Format<PyFormatContext<'_>> for FormatString<'a> {
|
|||
);
|
||||
format_docstring(&string_part, f)
|
||||
}
|
||||
StringLayout::ImplicitConcatenatedBinaryLeftSide => {
|
||||
StringLayout::ImplicitConcatenatedStringInBinaryLike => {
|
||||
FormatStringContinuation::new(self.string).fmt(f)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue