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

Check sequence type before triggering unnecessary-enumerate (FURB148) len suggestion #7781

Merged
merged 6 commits into from
Oct 3, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add generator test
  • Loading branch information
tjkuson committed Oct 3, 2023
commit d41f163933d860bc8864b10e4a868892ec596011
6 changes: 6 additions & 0 deletions crates/ruff_linter/resources/test/fixtures/refurb/FURB148.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,9 @@

for book in books:
print(book)

# Generators don't support the len() function.
# https://github.com/astral-sh/ruff/issues/7656
a = (b for b in range(1, 100))
for i, _ in enumerate(a):
print(i)