mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-23 13:05:06 +00:00
Upgrade RustPython (#4900)
This commit is contained in:
parent
4b78141f6b
commit
39a1f3980f
51 changed files with 416 additions and 320 deletions
|
@ -745,9 +745,13 @@ fn find_pos_only_slash_offset(
|
|||
),
|
||||
locator.contents(),
|
||||
)
|
||||
.map(|(offset, c)| {
|
||||
debug_assert_eq!(c, '/');
|
||||
offset
|
||||
.and_then(|(offset, c)| {
|
||||
if c == '/' {
|
||||
Some(offset)
|
||||
} else {
|
||||
debug_assert_eq!(c, ')');
|
||||
None
|
||||
}
|
||||
})
|
||||
},
|
||||
)
|
||||
|
|
|
@ -5,8 +5,8 @@ expression: comments.debug(test_case.source_code)
|
|||
{
|
||||
Node {
|
||||
kind: Arguments,
|
||||
range: 10..94,
|
||||
source: `a=10,/, # trailing position...t comment.⏎`,
|
||||
range: 9..96,
|
||||
source: `(a=10,/, # trailing positio...t comment.⏎`,
|
||||
}: {
|
||||
"leading": [],
|
||||
"dangling": [
|
||||
|
|
|
@ -5,8 +5,8 @@ expression: comments.debug(test_case.source_code)
|
|||
{
|
||||
Node {
|
||||
kind: Arguments,
|
||||
range: 15..177,
|
||||
source: `a=10 # trailing positional comment⏎`,
|
||||
range: 9..179,
|
||||
source: `(⏎`,
|
||||
}: {
|
||||
"leading": [],
|
||||
"dangling": [
|
||||
|
|
|
@ -3,25 +3,10 @@ source: crates/ruff_python_formatter/src/comments/mod.rs
|
|||
expression: comments.debug(test_case.source_code)
|
||||
---
|
||||
{
|
||||
Node {
|
||||
kind: Arg,
|
||||
range: 15..16,
|
||||
source: `a`,
|
||||
}: {
|
||||
"leading": [],
|
||||
"dangling": [],
|
||||
"trailing": [
|
||||
SourceComment {
|
||||
text: "# trailing positional comment",
|
||||
position: EndOfLine,
|
||||
formatted: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
Node {
|
||||
kind: Arguments,
|
||||
range: 15..168,
|
||||
source: `a, # trailing positional comment⏎`,
|
||||
range: 9..170,
|
||||
source: `(⏎`,
|
||||
}: {
|
||||
"leading": [],
|
||||
"dangling": [
|
||||
|
@ -38,6 +23,21 @@ expression: comments.debug(test_case.source_code)
|
|||
],
|
||||
"trailing": [],
|
||||
},
|
||||
Node {
|
||||
kind: Arg,
|
||||
range: 15..16,
|
||||
source: `a`,
|
||||
}: {
|
||||
"leading": [],
|
||||
"dangling": [],
|
||||
"trailing": [
|
||||
SourceComment {
|
||||
text: "# trailing positional comment",
|
||||
position: EndOfLine,
|
||||
formatted: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
Node {
|
||||
kind: Arg,
|
||||
range: 166..167,
|
||||
|
|
|
@ -3,6 +3,26 @@ source: crates/ruff_python_formatter/src/comments/mod.rs
|
|||
expression: comments.debug(test_case.source_code)
|
||||
---
|
||||
{
|
||||
Node {
|
||||
kind: Arguments,
|
||||
range: 9..166,
|
||||
source: `(⏎`,
|
||||
}: {
|
||||
"leading": [],
|
||||
"dangling": [
|
||||
SourceComment {
|
||||
text: "# Positional arguments only after here",
|
||||
position: OwnLine,
|
||||
formatted: false,
|
||||
},
|
||||
SourceComment {
|
||||
text: "# trailing positional argument comment.",
|
||||
position: EndOfLine,
|
||||
formatted: false,
|
||||
},
|
||||
],
|
||||
"trailing": [],
|
||||
},
|
||||
Node {
|
||||
kind: Arg,
|
||||
range: 15..16,
|
||||
|
@ -16,42 +36,11 @@ expression: comments.debug(test_case.source_code)
|
|||
position: EndOfLine,
|
||||
formatted: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
Node {
|
||||
kind: Arguments,
|
||||
range: 15..97,
|
||||
source: `a, # trailing positional comment⏎`,
|
||||
}: {
|
||||
"leading": [],
|
||||
"dangling": [
|
||||
SourceComment {
|
||||
text: "# Positional arguments only after here",
|
||||
position: OwnLine,
|
||||
formatted: false,
|
||||
},
|
||||
],
|
||||
"trailing": [
|
||||
SourceComment {
|
||||
text: "# trailing positional argument comment.",
|
||||
position: EndOfLine,
|
||||
formatted: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
Node {
|
||||
kind: StmtPass,
|
||||
range: 168..172,
|
||||
source: `pass`,
|
||||
}: {
|
||||
"leading": [
|
||||
SourceComment {
|
||||
text: "# Trailing on new line",
|
||||
position: OwnLine,
|
||||
formatted: false,
|
||||
},
|
||||
],
|
||||
"dangling": [],
|
||||
"trailing": [],
|
||||
},
|
||||
}
|
||||
|
|
|
@ -3,25 +3,10 @@ source: crates/ruff_python_formatter/src/comments/mod.rs
|
|||
expression: comments.debug(test_case.source_code)
|
||||
---
|
||||
{
|
||||
Node {
|
||||
kind: Arg,
|
||||
range: 15..16,
|
||||
source: `a`,
|
||||
}: {
|
||||
"leading": [],
|
||||
"dangling": [],
|
||||
"trailing": [
|
||||
SourceComment {
|
||||
text: "# trailing positional comment",
|
||||
position: EndOfLine,
|
||||
formatted: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
Node {
|
||||
kind: Arguments,
|
||||
range: 15..168,
|
||||
source: `a # trailing positional comment⏎`,
|
||||
range: 9..170,
|
||||
source: `(⏎`,
|
||||
}: {
|
||||
"leading": [],
|
||||
"dangling": [
|
||||
|
@ -38,6 +23,21 @@ expression: comments.debug(test_case.source_code)
|
|||
],
|
||||
"trailing": [],
|
||||
},
|
||||
Node {
|
||||
kind: Arg,
|
||||
range: 15..16,
|
||||
source: `a`,
|
||||
}: {
|
||||
"leading": [],
|
||||
"dangling": [],
|
||||
"trailing": [
|
||||
SourceComment {
|
||||
text: "# trailing positional comment",
|
||||
position: EndOfLine,
|
||||
formatted: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
Node {
|
||||
kind: Arg,
|
||||
range: 166..167,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue