-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[refurb
] Support itemgetter
in reimplemented-operator
(FURB118
)
#10526
[refurb
] Support itemgetter
in reimplemented-operator
(FURB118
)
#10526
Conversation
944e9b8
to
e23a66a
Compare
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
FURB118 | 95 | 95 | 0 | 0 | 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
itemgetter
in reimplemented_operator
(FURB118) lintrefurb
] Support itemgetter
in reimplemented-operator
(FURB118
)
a4ef367
to
cd6afb8
Compare
…`) (astral-sh#10526) ## Summary Lint about function like expressions which are equivalent to `operator.itemgetter`. See: astral-sh#1348 (comment) ## Test Plan cargo test
-return groupby(list(self.iter_choices()), key=lambda x: x[3:])
+return groupby(list(self.iter_choices()), key=operator.itemgetter(slice(3, None))) Not a fan of this change tbh. While it may have slightly better performance, it's much less readable... It's also much longer, but that's mainly because it prefers That aside I really like having a lint rule that prefers itemgetter over lambdas. Just not for slices... |
Summary
Lint about function like expressions which are equivalent to
operator.itemgetter
.See: #1348 (comment)
Test Plan
cargo test