f2fb3c9659
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". |
||
---|---|---|
.. | ||
1_minimum_example.rs | ||
2_many_in_connectors_in_pattern.rs | ||
3_nested_for_loop_with_connector_in_pattern.rs | ||
4_nested_for_loop_with_if_elseif_else.rs | ||
5_nested_for_loop_with_connector_in_if_elseif_else.rs | ||
6_deeply_nested_for_loop_with_connector_in_pattern.rs |