mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
Auto-format: cargo fmt --all
This commit is contained in:
@@ -704,7 +704,7 @@ impl PyObject {
|
||||
|
||||
if let Some(class_getitem) =
|
||||
vm.get_attribute_opt(self.to_owned(), identifier!(vm, __class_getitem__))?
|
||||
&& !vm.is_none(&class_getitem)
|
||||
&& !vm.is_none(&class_getitem)
|
||||
{
|
||||
return class_getitem.call((needle,), vm);
|
||||
}
|
||||
|
||||
@@ -137,10 +137,7 @@ pub(crate) mod _ast {
|
||||
let is_list_field = if field_name == "args" {
|
||||
class_name == "Call" || class_name == "arguments"
|
||||
} else if field_name == "body" || field_name == "orelse" {
|
||||
!matches!(
|
||||
class_name.as_str(),
|
||||
"Lambda" | "Expression" | "IfExp"
|
||||
)
|
||||
!matches!(class_name.as_str(), "Lambda" | "Expression" | "IfExp")
|
||||
} else {
|
||||
LIST_FIELDS.contains(&field_name)
|
||||
};
|
||||
|
||||
@@ -154,15 +154,13 @@ mod builtins {
|
||||
|
||||
// compile(ast_node, ..., PyCF_ONLY_AST) returns the AST after validation
|
||||
if is_ast_only {
|
||||
let (expected_type, expected_name) = ast::mode_type_and_name(
|
||||
&vm.ctx, mode_str,
|
||||
)
|
||||
.ok_or_else(|| {
|
||||
vm.new_value_error(
|
||||
"compile() mode must be 'exec', 'eval', 'single' or 'func_type'"
|
||||
.to_owned(),
|
||||
)
|
||||
})?;
|
||||
let (expected_type, expected_name) = ast::mode_type_and_name(&vm.ctx, mode_str)
|
||||
.ok_or_else(|| {
|
||||
vm.new_value_error(
|
||||
"compile() mode must be 'exec', 'eval', 'single' or 'func_type'"
|
||||
.to_owned(),
|
||||
)
|
||||
})?;
|
||||
if !args.source.fast_isinstance(&expected_type) {
|
||||
return Err(vm.new_type_error(format!(
|
||||
"expected {} node, got {}",
|
||||
|
||||
Reference in New Issue
Block a user