ruff/crates/ruff_python_formatter/src
Dylan 116611bd39
Fix finding keyword range for clause header after statement ending with semicolon (#21067)
When formatting clause headers for clauses that are not their own node,
like an `else` clause or `finally` clause, we begin searching for the
keyword at the end of the previous statement. However, if the previous
statement ended in a semicolon this caused a panic because we only
expected trivia between the end of the last statement and the keyword.

This PR adjusts the starting point of our search for the keyword to
begin after the optional semicolon in these cases.

Closes #21065
2025-10-27 09:52:17 -05:00
..
comments [ruff] improve handling of intermixed comments inside from-imports (#20561) 2025-10-07 08:14:09 -07:00
expression Remove parentheses around multiple exception types on Python 3.14+ (#20768) 2025-10-14 11:17:45 -04:00
module [ty] AST garbage collection (#18482) 2025-06-13 08:40:11 -04:00
other Avoid reusing nested, interpolated quotes before Python 3.12 (#20930) 2025-10-17 08:49:16 -04:00
pattern Update pre-commit dependencies (#19162) 2025-07-07 04:07:44 +00:00
snapshots Update insta snapshots (#14366) 2024-11-15 19:31:15 +01:00
statement Fix finding keyword range for clause header after statement ending with semicolon (#21067) 2025-10-27 09:52:17 -05:00
string Avoid reusing nested, interpolated quotes before Python 3.12 (#20930) 2025-10-17 08:49:16 -04:00
type_param [ty] AST garbage collection (#18482) 2025-06-13 08:40:11 -04:00
builders.rs Implement template strings (#17851) 2025-05-30 15:00:56 -05:00
cli.rs Remove parentheses around multiple exception types on Python 3.14+ (#20768) 2025-10-14 11:17:45 -04:00
context.rs Avoid reusing nested, interpolated quotes before Python 3.12 (#20930) 2025-10-17 08:49:16 -04:00
db.rs Update Rust toolchain to 1.88 and MSRV to 1.86 (#19011) 2025-06-28 20:24:00 +02:00
generated.rs Implement template strings (#17851) 2025-05-30 15:00:56 -05:00
lib.rs Render a diagnostic for syntax errors introduced in formatter tests (#21021) 2025-10-21 13:47:26 -04:00
main.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
options.rs [ruff] Update schemars to v1 (#20942) 2025-10-20 08:59:52 +02:00
prelude.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
preview.rs Remove parentheses around multiple exception types on Python 3.14+ (#20768) 2025-10-14 11:17:45 -04:00
range.rs [ty] AST garbage collection (#18482) 2025-06-13 08:40:11 -04:00
shared_traits.rs Upgrade Rust toolchain to 1.83 (#14677) 2024-11-29 12:05:05 +00:00
verbatim.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00