Skip to content

Feature Request: Vertical semicolon when wrapping function chains #5451

@wormingdead

Description

@wormingdead

I ended up writing this feature request formatted like the Rustfmt options docs. Please let me know if more information is needed or if I somehow missed that this option already exists.

fn_chain_vertical_semicolon

Vertically wrap the semicolon at the end of a vertical function chain.

Pros

  • Easier to visually scan the leftmost character to see when the method calls stop and the semicolon ends the statement.
  • IDEs that support single-line commenting don't have to be corrected after commenting out the last line.
    • e.g. in the false example, an IDE may replace .dolor(); with // .dolor(); and comment out the semicolon causing an error.

Cons

  • Adds a basically empty line, making code taller than necessary.

  • Default: I don't know how this is decided. As it is currently unimplemented, the default is false.
  • Possible Values: true, false

false:

fn main() {
    lorem
        .ipsum()
        .dolor();
}

true:

fn main() {
    lorem
        .ipsum()
        .dolor()
        ;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: a feature request (not decided/implemented)P-lowLow prioritycommunity drivenIssues the rustfmt team will not work on directly. Intended for contributors!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions