mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 21:05:08 +00:00
Fix unstable f-string formatting for expressions containing a trailing comma (#15545)
This commit is contained in:
parent
fdb9f4e404
commit
1ecb7ce645
4 changed files with 45 additions and 0 deletions
|
@ -147,6 +147,17 @@ pub(crate) enum FStringState {
|
|||
Outside,
|
||||
}
|
||||
|
||||
impl FStringState {
|
||||
pub(crate) fn can_contain_line_breaks(self) -> Option<bool> {
|
||||
match self {
|
||||
FStringState::InsideExpressionElement(context) => {
|
||||
Some(context.can_contain_line_breaks())
|
||||
}
|
||||
FStringState::Outside => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The position of a top-level statement in the module.
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, Default)]
|
||||
pub(crate) enum TopLevelStatementPosition {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue