[Feature Request] configure blank lines between related items
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
related to: https://github.com/rust-lang/rustfmt/issues/3382
I'd like to request an option to specify the amount of blank lines between related items.
Related items either share the same concrete Type:
struct Aenum Aimpl Aimpl<T> Aimpl Trait for A
Or the same Trait type:
trait Timpl T for A
Formatting rule
- Between items in the same group: N blank lines. (default to 0 or 1)
- Between different groups: exactly M blank lines (typically 1).
Example normalization (N = 0, M = 1):
struct A;
impl A {
//...
}
struct B;
impl B {
//...
};
Example configuration could be
top_level_items_related_blank_lines = 0
top_level_items_unrelated_blank_lines = 1
Inferring macros would be out of scope.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the related rustfmt issue #3382 and the requested grouping examples. Define how related top-level items are identified, how the two blank-line configuration options interact, and what defaults apply. Done means rustfmt consistently separates related and unrelated items as specified, without requiring macro inference.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100