-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
lazy not accounted for in ChainArrayAllocation cop #230
Comments
Indeed, looks like a bug. BTW, Also not clear in your example why |
This is true, I'm sure. But, for most things the perf difference is small enough to justify the one-liner vs the 3-4 line equivalent. It is particularly so in my use case. Also, thanks for the cool cop! |
🤦, of course. |
…ocation` Fixes rubocop#230. This PR fixes a false positive for `Performance/ChainArrayAllocation` when using `Enumerable#lazy`.
…chain_array_allocation [Fix #230] Fix a false positive for `Performance/ChainArrayAllocation`
lazy
in a chain should negate the ChainArrayAllocation cop.Expected behavior
Should not trigger a perf cop since this is actually a
very performant(at least not too aweful) way of getting the first non-nil result.lazy
should negate the chain cop as it no longer is a performance issue.Actual behavior
Cop triggers as follows:
Steps to reproduce the problem
Run perf cops on above code snippet.
RuboCop version
The text was updated successfully, but these errors were encountered: