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

unused_enumerated rule should check if only index is used #1278

Closed
marcelofabri opened this issue Feb 2, 2017 · 4 comments
Closed

unused_enumerated rule should check if only index is used #1278

marcelofabri opened this issue Feb 2, 2017 · 4 comments

Comments

@marcelofabri
Copy link
Collaborator

// Bad
for (idx, _) in bar.enumerated() { }

// Good
for idx in bar.indices { }
@agordeev
Copy link

This rule shouldn't apply to ranges and slices:

for (i, _) in range.enumerated() {}

is not the same to

for i in range.indices {}

@jpsim
Copy link
Collaborator

jpsim commented Nov 29, 2018

Are you reporting a bug or just sharing your thoughts on the matter?

@agordeev
Copy link

Well, I can't say it is a bug. Probably this case was not considered when this feature was developed.

What I want to say is now this row:

for (i, _) in range.enumerated() {}

triggers the unused_enumerated warning. Which shouldn't be happen IMHO.

@jpsim
Copy link
Collaborator

jpsim commented Nov 29, 2018

Can you please file a new issue, taking care to fill out the template, so that we can understand exactly what you're referring to? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants