Fix fmt:skip for function with return type (#6733)

This commit is contained in:
Micha Reiser 2023-08-21 17:45:23 +02:00 committed by GitHub
parent d5a51b4e45
commit 17a26e6ff3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 1 deletions

View file

@ -26,3 +26,13 @@ def test [
B,
] (): # fmt: skip
...
def test [
# comment
A,
# another
B,
] () -> str: # fmt: skip
...

View file

@ -108,13 +108,17 @@ impl<'a> ClauseHeader<'a> {
is_async: _,
decorator_list: _,
name: _,
returns: _,
returns,
body: _,
}) => {
if let Some(type_params) = type_params.as_ref() {
visit(type_params, visitor);
}
visit(parameters.as_ref(), visitor);
if let Some(returns) = returns.as_deref() {
visit(returns, visitor);
}
}
ClauseHeader::If(StmtIf {
test,

View file

@ -32,6 +32,16 @@ def test [
B,
] (): # fmt: skip
...
def test [
# comment
A,
# another
B,
] () -> str: # fmt: skip
...
```
## Output
@ -67,6 +77,17 @@ def test [
B,
] (): # fmt: skip
...
def test [
# comment
A,
# another
B,
] () -> str: # fmt: skip
...
```