Skip to content

Commit 6eea5dc

Browse files
Auto-format: cargo fmt --all
1 parent acb9cf8 commit 6eea5dc

File tree

5 files changed

+25
-19
lines changed

5 files changed

+25
-19
lines changed

crates/codegen/src/unparse.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,7 @@ impl<'a, 'b, 'c> Unparser<'a, 'b, 'c> {
363363
self.p(")")?;
364364
}
365365
ast::Expr::FString(ast::ExprFString { value, .. }) => self.unparse_fstring(value)?,
366-
ast::Expr::TString(ast::ExprTString { value, .. }) => {
367-
self.unparse_tstring(value)?
368-
}
366+
ast::Expr::TString(ast::ExprTString { value, .. }) => self.unparse_tstring(value)?,
369367
ast::Expr::StringLiteral(ast::ExprStringLiteral { value, .. }) => {
370368
if value.is_unicode() {
371369
self.p("u")?

crates/vm/src/stdlib/ast/expression.rs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -336,18 +336,27 @@ impl Node for ast::ExprLambda {
336336
.into_ref_with_type(vm, pyast::NodeArguments::static_type().to_owned())
337337
.unwrap();
338338
let args_dict = args_node.as_object().dict().unwrap();
339-
args_dict.set_item("posonlyargs", vm.ctx.new_list(vec![]).into(), vm).unwrap();
340-
args_dict.set_item("args", vm.ctx.new_list(vec![]).into(), vm).unwrap();
339+
args_dict
340+
.set_item("posonlyargs", vm.ctx.new_list(vec![]).into(), vm)
341+
.unwrap();
342+
args_dict
343+
.set_item("args", vm.ctx.new_list(vec![]).into(), vm)
344+
.unwrap();
341345
args_dict.set_item("vararg", vm.ctx.none(), vm).unwrap();
342-
args_dict.set_item("kwonlyargs", vm.ctx.new_list(vec![]).into(), vm).unwrap();
343-
args_dict.set_item("kw_defaults", vm.ctx.new_list(vec![]).into(), vm).unwrap();
346+
args_dict
347+
.set_item("kwonlyargs", vm.ctx.new_list(vec![]).into(), vm)
348+
.unwrap();
349+
args_dict
350+
.set_item("kw_defaults", vm.ctx.new_list(vec![]).into(), vm)
351+
.unwrap();
344352
args_dict.set_item("kwarg", vm.ctx.none(), vm).unwrap();
345-
args_dict.set_item("defaults", vm.ctx.new_list(vec![]).into(), vm).unwrap();
353+
args_dict
354+
.set_item("defaults", vm.ctx.new_list(vec![]).into(), vm)
355+
.unwrap();
346356
args_node.into()
347357
}
348358
};
349-
dict.set_item("args", args, vm)
350-
.unwrap();
359+
dict.set_item("args", args, vm).unwrap();
351360
dict.set_item("body", body.ast_to_object(vm, source_file), vm)
352361
.unwrap();
353362
node_add_location(&dict, _range, vm, source_file);

crates/vm/src/stdlib/ast/parameter.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,7 @@ impl Node for ast::Parameter {
127127
)
128128
.unwrap();
129129
// Ruff AST doesn't track type_comment, so always set to None
130-
dict.set_item("type_comment", _vm.ctx.none(), _vm)
131-
.unwrap();
130+
dict.set_item("type_comment", _vm.ctx.none(), _vm).unwrap();
132131
node_add_location(&dict, range, _vm, source_file);
133132
node.into()
134133
}

crates/vm/src/stdlib/ast/python.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ pub(crate) mod _ast {
8989

9090
// Set default values only for built-in AST nodes (_field_types present).
9191
// Custom AST subclasses without _field_types do NOT get automatic defaults.
92-
let has_field_types = zelf.class().get_attr(vm.ctx.intern_str("_field_types")).is_some();
92+
let has_field_types = zelf
93+
.class()
94+
.get_attr(vm.ctx.intern_str("_field_types"))
95+
.is_some();
9396
if has_field_types {
9497
// ASDL list fields (type*) default to empty list,
9598
// optional fields (type?) default to None.

crates/vm/src/stdlib/ast/statement.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,7 @@ impl Node for ast::StmtFunctionDef {
183183
dict.set_item("returns", returns.ast_to_object(vm, source_file), vm)
184184
.unwrap();
185185
// Ruff AST doesn't track type_comment, so always set to None
186-
dict.set_item("type_comment", vm.ctx.none(), vm)
187-
.unwrap();
186+
dict.set_item("type_comment", vm.ctx.none(), vm).unwrap();
188187
dict.set_item(
189188
"type_params",
190189
type_params
@@ -648,8 +647,7 @@ impl Node for ast::StmtFor {
648647
dict.set_item("orelse", orelse.ast_to_object(_vm, source_file), _vm)
649648
.unwrap();
650649
// Ruff AST doesn't track type_comment, so always set to None
651-
dict.set_item("type_comment", _vm.ctx.none(), _vm)
652-
.unwrap();
650+
dict.set_item("type_comment", _vm.ctx.none(), _vm).unwrap();
653651
node_add_location(&dict, _range, _vm, source_file);
654652
node.into()
655653
}
@@ -801,8 +799,7 @@ impl Node for ast::StmtWith {
801799
dict.set_item("body", body.ast_to_object(_vm, source_file), _vm)
802800
.unwrap();
803801
// Ruff AST doesn't track type_comment, so always set to None
804-
dict.set_item("type_comment", _vm.ctx.none(), _vm)
805-
.unwrap();
802+
dict.set_item("type_comment", _vm.ctx.none(), _vm).unwrap();
806803
node_add_location(&dict, _range, _vm, source_file);
807804
node.into()
808805
}

0 commit comments

Comments
 (0)