Skip to content

Commit 0cf6617

Browse files
committed
[pyupgrade] remove unecessary Expr::Attribute match
Remove the `Expr::Attribute` matching for the second parameter in `super`. The UP008 does not care when it's an Attribute, the only cases are: - super(MyClass, self) - super(OuterClass.InnerClass, self) Which is always an `Expr::Name`
1 parent ff11db4 commit 0cf6617

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

crates/ruff_linter/src/rules/pyupgrade/rules/super_call_with_parameters.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,15 @@ pub(crate) fn super_call_with_parameters(checker: &Checker, call: &ast::ExprCall
128128
};
129129

130130
let first_arg_id = match first_arg {
131+
// Simple case: super(MyClass, self)
131132
Expr::Name(ast::ExprName { id, .. }) => id,
133+
// Nested class case: super(OuterClass.InnerClass, self)
132134
Expr::Attribute(ast::ExprAttribute { attr, .. }) => &attr.id,
133135
_ => return,
134136
};
135137

136138
let second_arg_id = match second_arg {
137139
Expr::Name(ast::ExprName { id, .. }) => id,
138-
Expr::Attribute(ast::ExprAttribute { attr, .. }) => &attr.id,
139140
_ => return,
140141
};
141142

0 commit comments

Comments
 (0)