Fix tests and clippy warnings
This commit is contained in:
@@ -1674,7 +1674,7 @@ enum Precedence {
|
||||
}
|
||||
|
||||
impl Precedence {
|
||||
fn increment_precedence(&self) -> Precedence {
|
||||
fn increment_precedence(self) -> Precedence {
|
||||
match self {
|
||||
Precedence::Or => Precedence::And,
|
||||
Precedence::And => Precedence::Not,
|
||||
|
||||
@@ -487,9 +487,8 @@ impl<'src> Parser<'src> {
|
||||
if self.eat(TokenKind::Comma) {
|
||||
trailing_comma_range = Some(maybe_comma_range);
|
||||
continue;
|
||||
} else {
|
||||
trailing_comma_range = None;
|
||||
}
|
||||
trailing_comma_range = None;
|
||||
|
||||
if kind.is_list_terminator(self) {
|
||||
break;
|
||||
|
||||
@@ -428,7 +428,7 @@ impl<'src> Parser<'src> {
|
||||
Pattern::MatchAs(ast::PatternMatchAs {
|
||||
range,
|
||||
pattern: None,
|
||||
name: if name.contains("_") {
|
||||
name: if name.contains('_') {
|
||||
None
|
||||
} else {
|
||||
Some(ast::Identifier {
|
||||
|
||||
@@ -375,7 +375,7 @@ impl<'src> Parser<'src> {
|
||||
|
||||
let parenthesized = self.eat(TokenKind::Lpar);
|
||||
let names =
|
||||
self.parse_delimited_list(RecoveryContextKind::ImportNames, |p| p.parse_alias(), true);
|
||||
self.parse_delimited_list(RecoveryContextKind::ImportNames, Parser::parse_alias, true);
|
||||
|
||||
if parenthesized {
|
||||
self.expect(TokenKind::Rpar);
|
||||
@@ -1460,7 +1460,7 @@ impl<'src> Parser<'src> {
|
||||
|
||||
let type_params = self.parse_delimited_list(
|
||||
RecoveryContextKind::TypeParams,
|
||||
|p| p.parse_type_param(),
|
||||
Parser::parse_type_param,
|
||||
true,
|
||||
);
|
||||
|
||||
|
||||
@@ -326,8 +326,8 @@ Program {
|
||||
Expr(
|
||||
StmtExpr {
|
||||
range: 122..147,
|
||||
value: IfExp(
|
||||
ExprIfExp {
|
||||
value: If(
|
||||
ExprIf {
|
||||
range: 122..147,
|
||||
test: BooleanLiteral(
|
||||
ExprBooleanLiteral {
|
||||
|
||||
@@ -540,8 +540,8 @@ Program {
|
||||
range: 228..229,
|
||||
},
|
||||
),
|
||||
value: IfExp(
|
||||
ExprIfExp {
|
||||
value: If(
|
||||
ExprIf {
|
||||
range: 230..249,
|
||||
test: BooleanLiteral(
|
||||
ExprBooleanLiteral {
|
||||
|
||||
@@ -286,8 +286,8 @@ Program {
|
||||
decorator_list: [
|
||||
Decorator {
|
||||
range: 94..112,
|
||||
expression: NamedExpr(
|
||||
ExprNamedExpr {
|
||||
expression: Named(
|
||||
ExprNamed {
|
||||
range: 95..112,
|
||||
target: Name(
|
||||
ExprName {
|
||||
|
||||
@@ -622,8 +622,8 @@ Program {
|
||||
arguments: Arguments {
|
||||
range: 203..227,
|
||||
args: [
|
||||
GeneratorExp(
|
||||
ExprGeneratorExp {
|
||||
Generator(
|
||||
ExprGenerator {
|
||||
range: 204..226,
|
||||
elt: Name(
|
||||
ExprName {
|
||||
@@ -678,6 +678,7 @@ Program {
|
||||
is_async: false,
|
||||
},
|
||||
],
|
||||
parenthesized: false,
|
||||
},
|
||||
),
|
||||
],
|
||||
|
||||
@@ -10,8 +10,8 @@ Program {
|
||||
Expr(
|
||||
StmtExpr {
|
||||
range: 1..18,
|
||||
value: GeneratorExp(
|
||||
ExprGeneratorExp {
|
||||
value: Generator(
|
||||
ExprGenerator {
|
||||
range: 1..18,
|
||||
elt: Name(
|
||||
ExprName {
|
||||
@@ -41,6 +41,7 @@ Program {
|
||||
is_async: false,
|
||||
},
|
||||
],
|
||||
parenthesized: true,
|
||||
},
|
||||
),
|
||||
},
|
||||
@@ -48,8 +49,8 @@ Program {
|
||||
Expr(
|
||||
StmtExpr {
|
||||
range: 19..42,
|
||||
value: GeneratorExp(
|
||||
ExprGeneratorExp {
|
||||
value: Generator(
|
||||
ExprGenerator {
|
||||
range: 19..42,
|
||||
elt: Name(
|
||||
ExprName {
|
||||
@@ -79,6 +80,7 @@ Program {
|
||||
is_async: true,
|
||||
},
|
||||
],
|
||||
parenthesized: true,
|
||||
},
|
||||
),
|
||||
},
|
||||
@@ -86,8 +88,8 @@ Program {
|
||||
Expr(
|
||||
StmtExpr {
|
||||
range: 43..84,
|
||||
value: GeneratorExp(
|
||||
ExprGeneratorExp {
|
||||
value: Generator(
|
||||
ExprGenerator {
|
||||
range: 43..84,
|
||||
elt: Name(
|
||||
ExprName {
|
||||
@@ -171,6 +173,7 @@ Program {
|
||||
is_async: false,
|
||||
},
|
||||
],
|
||||
parenthesized: true,
|
||||
},
|
||||
),
|
||||
},
|
||||
@@ -178,8 +181,8 @@ Program {
|
||||
Expr(
|
||||
StmtExpr {
|
||||
range: 85..130,
|
||||
value: GeneratorExp(
|
||||
ExprGeneratorExp {
|
||||
value: Generator(
|
||||
ExprGenerator {
|
||||
range: 85..130,
|
||||
elt: Name(
|
||||
ExprName {
|
||||
@@ -276,6 +279,7 @@ Program {
|
||||
is_async: false,
|
||||
},
|
||||
],
|
||||
parenthesized: true,
|
||||
},
|
||||
),
|
||||
},
|
||||
@@ -283,8 +287,8 @@ Program {
|
||||
Expr(
|
||||
StmtExpr {
|
||||
range: 131..182,
|
||||
value: GeneratorExp(
|
||||
ExprGeneratorExp {
|
||||
value: Generator(
|
||||
ExprGenerator {
|
||||
range: 131..182,
|
||||
elt: Name(
|
||||
ExprName {
|
||||
@@ -381,6 +385,7 @@ Program {
|
||||
is_async: true,
|
||||
},
|
||||
],
|
||||
parenthesized: true,
|
||||
},
|
||||
),
|
||||
},
|
||||
@@ -401,8 +406,8 @@ Program {
|
||||
arguments: Arguments {
|
||||
range: 184..198,
|
||||
args: [
|
||||
GeneratorExp(
|
||||
ExprGeneratorExp {
|
||||
Generator(
|
||||
ExprGenerator {
|
||||
range: 185..197,
|
||||
elt: Name(
|
||||
ExprName {
|
||||
@@ -432,6 +437,7 @@ Program {
|
||||
is_async: false,
|
||||
},
|
||||
],
|
||||
parenthesized: false,
|
||||
},
|
||||
),
|
||||
],
|
||||
@@ -464,8 +470,8 @@ Program {
|
||||
ctx: Load,
|
||||
},
|
||||
),
|
||||
GeneratorExp(
|
||||
ExprGeneratorExp {
|
||||
Generator(
|
||||
ExprGenerator {
|
||||
range: 204..216,
|
||||
elt: Name(
|
||||
ExprName {
|
||||
@@ -495,6 +501,7 @@ Program {
|
||||
is_async: false,
|
||||
},
|
||||
],
|
||||
parenthesized: false,
|
||||
},
|
||||
),
|
||||
],
|
||||
@@ -527,8 +534,8 @@ Program {
|
||||
ctx: Load,
|
||||
},
|
||||
),
|
||||
GeneratorExp(
|
||||
ExprGeneratorExp {
|
||||
Generator(
|
||||
ExprGenerator {
|
||||
range: 223..238,
|
||||
elt: Name(
|
||||
ExprName {
|
||||
@@ -574,6 +581,7 @@ Program {
|
||||
is_async: false,
|
||||
},
|
||||
],
|
||||
parenthesized: false,
|
||||
},
|
||||
),
|
||||
],
|
||||
|
||||
@@ -10,8 +10,8 @@ Program {
|
||||
Expr(
|
||||
StmtExpr {
|
||||
range: 1..17,
|
||||
value: IfExp(
|
||||
ExprIfExp {
|
||||
value: If(
|
||||
ExprIf {
|
||||
range: 1..17,
|
||||
test: BooleanLiteral(
|
||||
ExprBooleanLiteral {
|
||||
@@ -40,8 +40,8 @@ Program {
|
||||
Expr(
|
||||
StmtExpr {
|
||||
range: 18..36,
|
||||
value: IfExp(
|
||||
ExprIfExp {
|
||||
value: If(
|
||||
ExprIf {
|
||||
range: 18..36,
|
||||
test: Name(
|
||||
ExprName {
|
||||
@@ -79,8 +79,8 @@ Program {
|
||||
Expr(
|
||||
StmtExpr {
|
||||
range: 37..62,
|
||||
value: IfExp(
|
||||
ExprIfExp {
|
||||
value: If(
|
||||
ExprIf {
|
||||
range: 37..62,
|
||||
test: Name(
|
||||
ExprName {
|
||||
@@ -96,8 +96,8 @@ Program {
|
||||
ctx: Load,
|
||||
},
|
||||
),
|
||||
orelse: IfExp(
|
||||
ExprIfExp {
|
||||
orelse: If(
|
||||
ExprIf {
|
||||
range: 49..62,
|
||||
test: Name(
|
||||
ExprName {
|
||||
@@ -129,8 +129,8 @@ Program {
|
||||
Expr(
|
||||
StmtExpr {
|
||||
range: 63..85,
|
||||
value: IfExp(
|
||||
ExprIfExp {
|
||||
value: If(
|
||||
ExprIf {
|
||||
range: 63..85,
|
||||
test: Compare(
|
||||
ExprCompare {
|
||||
@@ -200,8 +200,8 @@ Program {
|
||||
Expr(
|
||||
StmtExpr {
|
||||
range: 86..109,
|
||||
value: IfExp(
|
||||
ExprIfExp {
|
||||
value: If(
|
||||
ExprIf {
|
||||
range: 86..109,
|
||||
test: Name(
|
||||
ExprName {
|
||||
@@ -245,8 +245,8 @@ Program {
|
||||
Expr(
|
||||
StmtExpr {
|
||||
range: 110..128,
|
||||
value: IfExp(
|
||||
ExprIfExp {
|
||||
value: If(
|
||||
ExprIf {
|
||||
range: 110..128,
|
||||
test: Name(
|
||||
ExprName {
|
||||
@@ -293,8 +293,8 @@ Program {
|
||||
Expr(
|
||||
StmtExpr {
|
||||
range: 129..155,
|
||||
value: IfExp(
|
||||
ExprIfExp {
|
||||
value: If(
|
||||
ExprIf {
|
||||
range: 129..155,
|
||||
test: BoolOp(
|
||||
ExprBoolOp {
|
||||
@@ -349,8 +349,8 @@ Program {
|
||||
),
|
||||
},
|
||||
),
|
||||
IfExp(
|
||||
ExprIfExp {
|
||||
If(
|
||||
ExprIf {
|
||||
range: 159..172,
|
||||
test: Name(
|
||||
ExprName {
|
||||
|
||||
@@ -287,8 +287,8 @@ Program {
|
||||
If(
|
||||
StmtIf {
|
||||
range: 175..187,
|
||||
test: NamedExpr(
|
||||
ExprNamedExpr {
|
||||
test: Named(
|
||||
ExprNamed {
|
||||
range: 178..182,
|
||||
target: Name(
|
||||
ExprName {
|
||||
|
||||
@@ -624,8 +624,8 @@ Program {
|
||||
ctx: Store,
|
||||
},
|
||||
),
|
||||
iter: IfExp(
|
||||
ExprIfExp {
|
||||
iter: If(
|
||||
ExprIf {
|
||||
range: 287..303,
|
||||
test: BooleanLiteral(
|
||||
ExprBooleanLiteral {
|
||||
@@ -688,8 +688,8 @@ Program {
|
||||
ctx: Store,
|
||||
},
|
||||
),
|
||||
iter: IfExp(
|
||||
ExprIfExp {
|
||||
iter: If(
|
||||
ExprIf {
|
||||
range: 324..346,
|
||||
test: BooleanLiteral(
|
||||
ExprBooleanLiteral {
|
||||
@@ -760,8 +760,8 @@ Program {
|
||||
iter: Await(
|
||||
ExprAwait {
|
||||
range: 366..390,
|
||||
value: IfExp(
|
||||
ExprIfExp {
|
||||
value: If(
|
||||
ExprIf {
|
||||
range: 373..389,
|
||||
test: BooleanLiteral(
|
||||
ExprBooleanLiteral {
|
||||
@@ -839,8 +839,8 @@ Program {
|
||||
arguments: Arguments {
|
||||
range: 410..429,
|
||||
args: [
|
||||
IfExp(
|
||||
ExprIfExp {
|
||||
If(
|
||||
ExprIf {
|
||||
range: 411..428,
|
||||
test: BooleanLiteral(
|
||||
ExprBooleanLiteral {
|
||||
|
||||
@@ -268,8 +268,8 @@ Program {
|
||||
arguments: Arguments {
|
||||
range: 76..100,
|
||||
args: [
|
||||
GeneratorExp(
|
||||
ExprGeneratorExp {
|
||||
Generator(
|
||||
ExprGenerator {
|
||||
range: 77..99,
|
||||
elt: Call(
|
||||
ExprCall {
|
||||
@@ -337,6 +337,7 @@ Program {
|
||||
is_async: false,
|
||||
},
|
||||
],
|
||||
parenthesized: false,
|
||||
},
|
||||
),
|
||||
],
|
||||
|
||||
@@ -2124,8 +2124,8 @@ Program {
|
||||
Match(
|
||||
StmtMatch {
|
||||
range: 1516..1610,
|
||||
subject: NamedExpr(
|
||||
ExprNamedExpr {
|
||||
subject: Named(
|
||||
ExprNamed {
|
||||
range: 1522..1528,
|
||||
target: Name(
|
||||
ExprName {
|
||||
@@ -2309,8 +2309,8 @@ Program {
|
||||
},
|
||||
),
|
||||
guard: Some(
|
||||
NamedExpr(
|
||||
ExprNamedExpr {
|
||||
Named(
|
||||
ExprNamed {
|
||||
range: 1651..1657,
|
||||
target: Name(
|
||||
ExprName {
|
||||
|
||||
@@ -10,8 +10,8 @@ Program {
|
||||
Expr(
|
||||
StmtExpr {
|
||||
range: 1..7,
|
||||
value: NamedExpr(
|
||||
ExprNamedExpr {
|
||||
value: Named(
|
||||
ExprNamed {
|
||||
range: 2..6,
|
||||
target: Name(
|
||||
ExprName {
|
||||
@@ -39,8 +39,8 @@ Program {
|
||||
ExprSet {
|
||||
range: 8..18,
|
||||
elts: [
|
||||
NamedExpr(
|
||||
ExprNamedExpr {
|
||||
Named(
|
||||
ExprNamed {
|
||||
range: 10..16,
|
||||
target: Name(
|
||||
ExprName {
|
||||
@@ -71,8 +71,8 @@ Program {
|
||||
ExprList {
|
||||
range: 19..27,
|
||||
elts: [
|
||||
NamedExpr(
|
||||
ExprNamedExpr {
|
||||
Named(
|
||||
ExprNamed {
|
||||
range: 20..26,
|
||||
target: Name(
|
||||
ExprName {
|
||||
@@ -100,8 +100,8 @@ Program {
|
||||
Expr(
|
||||
StmtExpr {
|
||||
range: 28..40,
|
||||
value: NamedExpr(
|
||||
ExprNamedExpr {
|
||||
value: Named(
|
||||
ExprNamed {
|
||||
range: 29..39,
|
||||
target: Name(
|
||||
ExprName {
|
||||
@@ -150,8 +150,8 @@ Program {
|
||||
ctx: Load,
|
||||
},
|
||||
),
|
||||
NamedExpr(
|
||||
ExprNamedExpr {
|
||||
Named(
|
||||
ExprNamed {
|
||||
range: 44..56,
|
||||
target: Name(
|
||||
ExprName {
|
||||
@@ -205,8 +205,8 @@ Program {
|
||||
ctx: Load,
|
||||
},
|
||||
),
|
||||
NamedExpr(
|
||||
ExprNamedExpr {
|
||||
Named(
|
||||
ExprNamed {
|
||||
range: 62..72,
|
||||
target: Name(
|
||||
ExprName {
|
||||
@@ -260,8 +260,8 @@ Program {
|
||||
ctx: Load,
|
||||
},
|
||||
),
|
||||
NamedExpr(
|
||||
ExprNamedExpr {
|
||||
Named(
|
||||
ExprNamed {
|
||||
range: 78..86,
|
||||
target: Name(
|
||||
ExprName {
|
||||
@@ -299,8 +299,8 @@ Program {
|
||||
arguments: Arguments {
|
||||
range: 89..101,
|
||||
args: [
|
||||
NamedExpr(
|
||||
ExprNamedExpr {
|
||||
Named(
|
||||
ExprNamed {
|
||||
range: 90..94,
|
||||
target: Name(
|
||||
ExprName {
|
||||
@@ -318,8 +318,8 @@ Program {
|
||||
),
|
||||
},
|
||||
),
|
||||
NamedExpr(
|
||||
ExprNamedExpr {
|
||||
Named(
|
||||
ExprNamed {
|
||||
range: 96..100,
|
||||
target: Name(
|
||||
ExprName {
|
||||
|
||||
@@ -108,8 +108,8 @@ Program {
|
||||
Expr(
|
||||
StmtExpr {
|
||||
range: 44..57,
|
||||
value: IfExp(
|
||||
ExprIfExp {
|
||||
value: If(
|
||||
ExprIf {
|
||||
range: 44..57,
|
||||
test: Name(
|
||||
ExprName {
|
||||
|
||||
@@ -692,8 +692,8 @@ Program {
|
||||
ctx: Load,
|
||||
},
|
||||
),
|
||||
slice: NamedExpr(
|
||||
ExprNamedExpr {
|
||||
slice: Named(
|
||||
ExprNamed {
|
||||
range: 123..129,
|
||||
target: Name(
|
||||
ExprName {
|
||||
@@ -867,8 +867,8 @@ Program {
|
||||
ExprSlice {
|
||||
range: 161..168,
|
||||
lower: Some(
|
||||
NamedExpr(
|
||||
ExprNamedExpr {
|
||||
Named(
|
||||
ExprNamed {
|
||||
range: 162..166,
|
||||
target: Name(
|
||||
ExprName {
|
||||
@@ -914,8 +914,8 @@ Program {
|
||||
ExprSlice {
|
||||
range: 172..180,
|
||||
lower: Some(
|
||||
NamedExpr(
|
||||
ExprNamedExpr {
|
||||
Named(
|
||||
ExprNamed {
|
||||
range: 173..177,
|
||||
target: Name(
|
||||
ExprName {
|
||||
|
||||
@@ -224,8 +224,8 @@ Program {
|
||||
While(
|
||||
StmtWhile {
|
||||
range: 152..169,
|
||||
test: NamedExpr(
|
||||
ExprNamedExpr {
|
||||
test: Named(
|
||||
ExprNamed {
|
||||
range: 158..164,
|
||||
target: Name(
|
||||
ExprName {
|
||||
|
||||
@@ -550,8 +550,8 @@ Program {
|
||||
items: [
|
||||
WithItem {
|
||||
range: 291..297,
|
||||
context_expr: NamedExpr(
|
||||
ExprNamedExpr {
|
||||
context_expr: Named(
|
||||
ExprNamed {
|
||||
range: 291..297,
|
||||
target: Name(
|
||||
ExprName {
|
||||
@@ -685,8 +685,8 @@ Program {
|
||||
ExprTuple {
|
||||
range: 365..376,
|
||||
elts: [
|
||||
NamedExpr(
|
||||
ExprNamedExpr {
|
||||
Named(
|
||||
ExprNamed {
|
||||
range: 366..372,
|
||||
target: Name(
|
||||
ExprName {
|
||||
|
||||
@@ -76,7 +76,7 @@ impl StringParser {
|
||||
|
||||
#[inline]
|
||||
fn range(&self, start_location: TextSize) -> TextRange {
|
||||
TextRange::new(dbg!(start_location), dbg!(self.offset))
|
||||
TextRange::new(start_location, self.offset)
|
||||
}
|
||||
|
||||
/// Returns the next byte in the string, if there is one.
|
||||
|
||||
@@ -126,8 +126,8 @@ Module(
|
||||
StmtAssign {
|
||||
range: 315..328,
|
||||
targets: [
|
||||
NamedExpr(
|
||||
ExprNamedExpr {
|
||||
Named(
|
||||
ExprNamed {
|
||||
range: 316..322,
|
||||
target: Name(
|
||||
ExprName {
|
||||
@@ -275,8 +275,8 @@ Module(
|
||||
StmtAssign {
|
||||
range: 367..385,
|
||||
targets: [
|
||||
IfExp(
|
||||
ExprIfExp {
|
||||
If(
|
||||
ExprIf {
|
||||
range: 367..380,
|
||||
test: Name(
|
||||
ExprName {
|
||||
@@ -558,8 +558,8 @@ Module(
|
||||
StmtAssign {
|
||||
range: 479..499,
|
||||
targets: [
|
||||
GeneratorExp(
|
||||
ExprGeneratorExp {
|
||||
Generator(
|
||||
ExprGenerator {
|
||||
range: 479..494,
|
||||
elt: Name(
|
||||
ExprName {
|
||||
@@ -589,6 +589,7 @@ Module(
|
||||
is_async: false,
|
||||
},
|
||||
],
|
||||
parenthesized: true,
|
||||
},
|
||||
),
|
||||
],
|
||||
@@ -1667,6 +1668,3 @@ Module(
|
||||
53 | (x, foo(), y) = (42, 42, 42)
|
||||
| ^^^^^^^^^^^^^ Syntax Error: invalid assignment target
|
||||
|
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ Module(
|
||||
Expr(
|
||||
StmtExpr {
|
||||
range: 120..128,
|
||||
value: NamedExpr(
|
||||
ExprNamedExpr {
|
||||
value: Named(
|
||||
ExprNamed {
|
||||
range: 121..127,
|
||||
target: NumberLiteral(
|
||||
ExprNumberLiteral {
|
||||
@@ -47,6 +47,3 @@ Module(
|
||||
3 | (5 := 3)
|
||||
| ^ Syntax Error: invalid assignment target
|
||||
|
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ Module(
|
||||
If(
|
||||
StmtIf {
|
||||
range: 0..19,
|
||||
test: NamedExpr(
|
||||
ExprNamedExpr {
|
||||
test: Named(
|
||||
ExprNamed {
|
||||
range: 3..9,
|
||||
target: Name(
|
||||
ExprName {
|
||||
@@ -45,8 +45,8 @@ Module(
|
||||
Expr(
|
||||
StmtExpr {
|
||||
range: 21..29,
|
||||
value: NamedExpr(
|
||||
ExprNamedExpr {
|
||||
value: Named(
|
||||
ExprNamed {
|
||||
range: 22..28,
|
||||
target: Name(
|
||||
ExprName {
|
||||
@@ -71,4 +71,3 @@ Module(
|
||||
},
|
||||
)
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user