-
Notifications
You must be signed in to change notification settings - Fork 1k
max_width not obeyed in match arm tuple #6848
Copy link
Copy link
Open
Labels
A-matchesArea: match arms, patterns, blocks, etcArea: match arms, patterns, blocks, etcC-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEF-impacts-stable-formatted-codeExpected formatting impact: affects stable formatted code (caution)Expected formatting impact: affects stable formatted code (caution)F-impacts-stable-optionsExpected formatting impact: impacts stable options (caution)Expected formatting impact: impacts stable options (caution)I-max-widthIssue: formatting exceeds maximum widthIssue: formatting exceeds maximum widthS-has-mcveStatus: a Minimal Complete and Verifiable Example has been found for this issueStatus: a Minimal Complete and Verifiable Example has been found for this issue
Metadata
Metadata
Assignees
Labels
A-matchesArea: match arms, patterns, blocks, etcArea: match arms, patterns, blocks, etcC-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEF-impacts-stable-formatted-codeExpected formatting impact: affects stable formatted code (caution)Expected formatting impact: affects stable formatted code (caution)F-impacts-stable-optionsExpected formatting impact: impacts stable options (caution)Expected formatting impact: impacts stable options (caution)I-max-widthIssue: formatting exceeds maximum widthIssue: formatting exceeds maximum widthS-has-mcveStatus: a Minimal Complete and Verifiable Example has been found for this issueStatus: a Minimal Complete and Verifiable Example has been found for this issue
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
rustfmtreformats a multi-line tuple pattern in amatcharm into a singleline that exceeds
max_width = 80.I tried to format this code:
Expected behavior
rustfmtshould preserve the multi-line tuple pattern, or otherwise format thearm so that it does not exceed
max_width = 80.Actual behavior
rustfmtrewrites it to:The formatted match arm is 87 columns wide, exceeding
max_width = 80.Configuration
rustfmt.toml:Reproduction Steps
Create a Rust file with the example above.
Create a
rustfmt.tomlcontaining:Run
cargo fmt(orrustfmton the file).Observe that the tuple pattern in the match arm is collapsed to one line.
Observe that the resulting line exceeds
max_width.Meta