-
Notifications
You must be signed in to change notification settings - Fork 1.7k
{flat_,}map_identity
: recognize |[x, y]| [x, y]
as an identity function as well
#15229
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
{flat_,}map_identity
: recognize |[x, y]| [x, y]
as an identity function as well
#15229
Conversation
{flat_,}map_identity
: recognize |[x, y]| [x,y]
as identity function as well{flat_,}map_identity
: recognize |[x, y]| [x, y]
as an identity function as well
should I add struct destructuring as well? It would be completely irrelevant EDIT: on another thought... maybe not -- even the "simpler" thing, tuple structs, would require delving into the horrors of |
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.
This looks good to me, thanks! Nice that you thought of match ergonomics, in the past they've caused some trouble in these identity lints :)
As for struct destructuring, I suppose conceptually it could make sense for this lint to catch them, but yeah, definitely not something you need to do here, this is a solid improvement on its own.
Could you squash the commits? |
edbf7a0
to
e610584
Compare
squashed (and rebased) |
changelog: [
map_identity
,flat_map_identity
]: also recognize|[x, y]| [x, y]
fixes #15198