mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-16 09:35:17 +00:00
Fix trailing kwargs end of line comment after slash (#10297)
## Summary Fixes the handling end of line comments that belong to `**kwargs` when the `**kwargs` come after a slash. The issue was that we missed to include the `**kwargs` start position when determining the start of the next node coming after the `/`. Fixes https://github.com/astral-sh/ruff/issues/10281 ## Test Plan Added test
This commit is contained in:
parent
c504d7ab11
commit
965adbed4b
3 changed files with 25 additions and 3 deletions
|
@ -450,6 +450,7 @@ pub(crate) fn find_parameter_separators(
|
|||
// * `f(a, /, b)`
|
||||
// * `f(a, /, *b)`
|
||||
// * `f(a, /, *, b)`
|
||||
// * `f(a, /, *, **b)`
|
||||
// * `f(a, /)`
|
||||
let slash_following_start = parameters
|
||||
.args
|
||||
|
@ -457,6 +458,7 @@ pub(crate) fn find_parameter_separators(
|
|||
.map(Ranged::start)
|
||||
.or(parameters.vararg.as_ref().map(|first| first.start()))
|
||||
.or(star.as_ref().map(|star| star.separator.start()))
|
||||
.or(parameters.kwarg.as_deref().map(Ranged::start))
|
||||
.unwrap_or(parameters.end());
|
||||
let slash = slash.map(|(preceding_end, slash)| ParameterSeparator {
|
||||
preceding_end,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue