Skip to content
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

Support for pass-blocks in Style/MapToHash and StyleMapToSet #11732

Closed
vlad-pisanov opened this issue Mar 24, 2023 · 0 comments · Fixed by #11735
Closed

Support for pass-blocks in Style/MapToHash and StyleMapToSet #11732

vlad-pisanov opened this issue Mar 24, 2023 · 0 comments · Fixed by #11735

Comments

@vlad-pisanov
Copy link
Contributor

Enhancement: currently, Style/MapToHash and StyleMapToSet only detect and autocorrect explicit blocks, but the same approach should work for pass-blocks as well:

# Before
list.map(&:foo).to_h
list.map(&:foo).to_set

# After
list.to_h(&:foo)
list.to_set(&:foo)
koic added a commit to koic/rubocop that referenced this issue Mar 24, 2023
… of symbol proc

Fixes rubocop#11732.

This PR makes `Style/MapToHash` and `Style/MapToSet` aware of symbol proc.
bbatsov pushed a commit that referenced this issue Mar 25, 2023
…bol proc

Fixes #11732.

This PR makes `Style/MapToHash` and `Style/MapToSet` aware of symbol proc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants