Skip to content

Single-line imports are unnecessarily wrapped #5927

@taylordotfish

Description

@taylordotfish

Imports that could fit on a single line are unnecessarily wrapped:

/* 50 characters:
0        1         2         3         4         5
12345678901234567890123456789012345678901234567890
*/
use aaaaaaaaa::{bbbbbbbbb, ccccccccc, ddddddddd};

After rustfmt --config max_width=50:

/* 50 characters:
0        1         2         3         4         5
12345678901234567890123456789012345678901234567890
*/
use aaaaaaaaa::{
    bbbbbbbbb, ccccccccc, ddddddddd,
};

The use declaration is only 49 characters but gets wrapped anyway. This also happens with the default max_width of 100 (use declarations > 98 characters get wrapped).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ytmimi@taylordotfish

        Issue actions

          Single-line imports are unnecessarily wrapped · Issue #5927 · rust-lang/rustfmt