fmt: set prefer_compact to "none" - #73
Merged
Merged
Conversation
Keeps events, errors, emit and revert on the same one-per-line multiline style as multiline_func_header = "all", rather than packing a broken list onto a single continuation line. Closes PaulRBerg#68. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #68.
Sets the
[fmt]option that replaced the deprecatedcall_compact_args, to the value suggested in foundry-rs/foundry#4024 (comment).What it changes
prefer_compactdefaults to"all", which first tries to pack a broken list onto a single continuation line."none"keeps one element per line instead, which matchesmultiline_func_header = "all"and is the style asked for in #4024:Placed alphabetically between
number_underscoreandquote_styleto match the rest of the block.Verification
Run against
forge 1.7.1(stable — whatfoundry-rs/foundry-toolchain@v1installs by default; the option is absent fromv1.4.0and earlier):forge configreportsprefer_compact = "none", so the key is recognised.forge fmt --checkexits0, sobun run full-checkis unaffected.forge fmtrewrites none of the five.solfiles. No source churn — none of them currently has a list long enough to break atline_length = 120, so this only shapes the code template users write later, which is the point.One gap worth flagging
The option takes effect for
eventanderrordeclarations,emitandrevert— but it does not appear to affect plain function calls. Minimal repro, identical on1.7.1and1.7.2-nightly:All three values produce byte-identical output (the args stay packed on one continuation line), even though
PreferCompact::calls()ismatches!(self, All | Calls). Since #4024 asks to "stick to the same multiline format everywhere", that may be worth raising upstream — it is not something this repo can fix, and it does not affect the value of setting the option here.🤖 Generated with Claude Code