Skip to content

Rustfmt fails to format let-chain #5661

Closed as not planned
Closed as not planned
@yanchith

Description

@yanchith

I have a Rust source file with a couple of longer (~1000 lines) functions with deep nesting, and many comments.

I sometimes notice rustfmt give up and not modify some parts of the code, even when it's visually clear they should be modified (e.g. reindented). rustfmt --check doesn't report any errors.

Not sure how to repro publicly, because I can't share the code this happens on, but if I ever see it happen on an open codebase, I'll share.

Also let me know if you'd accept a patch fixing this, maybe I can debug in my spare time.

version: rustfmt 1.5.1-nightly (8a97b481 2022-12-22)
config:

group_imports = "StdExternalCrate"
hex_literal_case = "Lower"
imports_layout = "HorizontalVertical"
merge_derives = false
newline_style = "Unix"
use_field_init_shorthand = true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions