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

Conversion between for_each and for-loop works worng for range expr #8367

Open
ghost opened this issue Apr 6, 2021 · 0 comments
Open

Conversion between for_each and for-loop works worng for range expr #8367

ghost opened this issue Apr 6, 2021 · 0 comments
Labels
A-assists S-actionable Someone could pick this issue up and work on it right now

Comments

@ghost
Copy link

ghost commented Apr 6, 2021

Related to #7741 and #7956

Conversion assists between for-loop and for_each are working well for normal iterable types, but it works wrong for range expr.

Example

  • for-loop into for_each
// before
for _ in 0..10 {}

// after
0..10.for_each(|_| {}); // syntax error
  • for_each into for-loop
// before
(0..v.len()).for_each(|_| {});

// after
for _ in (0..v.len()) {} // warning by unnecessary parentheses
@lnicola lnicola added A-assists S-actionable Someone could pick this issue up and work on it right now labels Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-assists S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

No branches or pull requests

1 participant