mirror of
https://github.com/astral-sh/ruff
synced 2026-01-08 15:14:19 -05:00
Treat class C: ... and class C(): ... equivalently (#8659)
## Summary These should be seen as identical from the `ComparableAst` perspective.
This commit is contained in:
@@ -363,7 +363,7 @@ impl<'a> From<&'a ast::Number> for ComparableNumber<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Hash)]
|
||||
#[derive(Debug, Default, PartialEq, Eq, Hash)]
|
||||
pub struct ComparableArguments<'a> {
|
||||
args: Vec<ComparableExpr<'a>>,
|
||||
keywords: Vec<ComparableKeyword<'a>>,
|
||||
@@ -1051,7 +1051,7 @@ pub struct StmtClassDef<'a> {
|
||||
decorator_list: Vec<ComparableDecorator<'a>>,
|
||||
name: &'a str,
|
||||
type_params: Option<ComparableTypeParams<'a>>,
|
||||
arguments: Option<ComparableArguments<'a>>,
|
||||
arguments: ComparableArguments<'a>,
|
||||
body: Vec<ComparableStmt<'a>>,
|
||||
}
|
||||
|
||||
@@ -1309,7 +1309,7 @@ impl<'a> From<&'a ast::Stmt> for ComparableStmt<'a> {
|
||||
range: _,
|
||||
}) => Self::ClassDef(StmtClassDef {
|
||||
name: name.as_str(),
|
||||
arguments: arguments.as_ref().map(Into::into),
|
||||
arguments: arguments.as_ref().map(Into::into).unwrap_or_default(),
|
||||
body: body.iter().map(Into::into).collect(),
|
||||
decorator_list: decorator_list.iter().map(Into::into).collect(),
|
||||
type_params: type_params.as_ref().map(Into::into),
|
||||
|
||||
Reference in New Issue
Block a user