-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Summary This PR is part of a bigger effort of re-implementing `refurb` rules #1348. It adds support for [FURB140](https://github.com/dosisod/refurb/blob/master/refurb/checks/itertools/use_starmap.py) ## Test Plan I included a new test + checked that all other tests pass.
- Loading branch information
1 parent
c6ba7df
commit 4123d07
Showing
9 changed files
with
562 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
def zipped(): | ||
return zip([1, 2, 3], "ABC") | ||
|
||
# Errors. | ||
|
||
# FURB140 | ||
[print(x, y) for x, y in zipped()] | ||
|
||
# FURB140 | ||
(print(x, y) for x, y in zipped()) | ||
|
||
# FURB140 | ||
{print(x, y) for x, y in zipped()} | ||
|
||
|
||
from itertools import starmap as sm | ||
|
||
# FURB140 | ||
[print(x, y) for x, y in zipped()] | ||
|
||
# FURB140 | ||
(print(x, y) for x, y in zipped()) | ||
|
||
# FURB140 | ||
{print(x, y) for x, y in zipped()} | ||
|
||
# Non-errors. | ||
|
||
[print(x, int) for x, _ in zipped()] | ||
|
||
[print(x, *y) for x, y in zipped()] | ||
|
||
[print(x, y, 1) for x, y in zipped()] | ||
|
||
[print(y, x) for x, y in zipped()] | ||
|
||
[print(x + 1, y) for x, y in zipped()] | ||
|
||
[print(x) for x in range(100)] | ||
|
||
[print() for x, y in zipped()] | ||
|
||
[print(x, end=y) for x, y in zipped()] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
pub(crate) use check_and_remove_from_set::*; | ||
pub(crate) use delete_full_slice::*; | ||
pub(crate) use reimplemented_starmap::*; | ||
pub(crate) use repeated_append::*; | ||
pub(crate) use slice_copy::*; | ||
|
||
mod check_and_remove_from_set; | ||
mod delete_full_slice; | ||
mod reimplemented_starmap; | ||
mod repeated_append; | ||
mod slice_copy; |
Oops, something went wrong.