Skip to content

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

@ghost

Description

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-assistsS-actionableSomeone could pick this issue up and work on it right now

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions