rust/tests/target/issue-5009
Yacin Tmimi f2fb3c9659 Update connector search in ControlFlow::rewrite_pat_expr for for loops
Resolves 5009

For loops represented by a ControlFlow object use " in" as their connector.
rustfmt searches for the first uncommented occurrence of the word "in" within the
current span and adjusts it's starting point to look for comments right after that.
visually this looks like this:

    rustfmt starts looking for comments here
            |
            V
    for x in /* ... */ 0..1 {}

This works well in most cases, however when the pattern also contains
the word "in", this leads to issues.

    rustfmt starts looking for comments here
          |
          V
    for in_here in /* ... */ 0..1 {}
        -------
        pattern

In order to correctly identify the connector, the new approach first
updates the span to start after the pattern and then searches for the
first uncommented occurrence of "in".
2021-10-13 19:36:37 -05:00
..
1_minimum_example.rs Update connector search in ControlFlow::rewrite_pat_expr for for loops 2021-10-13 19:36:37 -05:00
2_many_in_connectors_in_pattern.rs Update connector search in ControlFlow::rewrite_pat_expr for for loops 2021-10-13 19:36:37 -05:00
3_nested_for_loop_with_connector_in_pattern.rs Update connector search in ControlFlow::rewrite_pat_expr for for loops 2021-10-13 19:36:37 -05:00
4_nested_for_loop_with_if_elseif_else.rs Update connector search in ControlFlow::rewrite_pat_expr for for loops 2021-10-13 19:36:37 -05:00
5_nested_for_loop_with_connector_in_if_elseif_else.rs Update connector search in ControlFlow::rewrite_pat_expr for for loops 2021-10-13 19:36:37 -05:00
6_deeply_nested_for_loop_with_connector_in_pattern.rs Update connector search in ControlFlow::rewrite_pat_expr for for loops 2021-10-13 19:36:37 -05:00