Skip to content

Range notation not handled as expected for binop_separator="Back" configuration #2364

Closed
@davidalber

Description

@davidalber

This was identified in #2361.

This issue affects formatting for range notation with binop_separator="Back".

Reproduction:

  1. Create a rustfmt.toml containing binop_separator="Back".
  2. Run rustfmt on the following file.
fn main() {
    let range = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa..
        bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;
}

Expected:
No diff after formatting.

Actual:
The operator is moved to the front.

 fn main() {⏎
-    let range = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa..⏎
-        bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;⏎
+    let range = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa⏎
+        ..bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;⏎
 }⏎
 ⏎

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueIssues up for grabs, also good candidates for new rustfmt contributorsonly-with-optionrequires a non-default option value to reproducepoor-formatting

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions