blank_lines_lower_bound ignores impl/traits functions
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
Version: rustfmt 2.0.0-rc.2-nightly (cc5521d9 2021-10-23)
rustfmt.toml:
tab_spaces = 2
blank_lines_lower_bound = 1
Before
fn a() {}
fn b() {}
mod foo {
fn a() {}
fn b() {}
}
struct Foo;
impl Foo {
fn a() {}
fn b() {}
}
trait Bar {
fn a();
fn b();
}
After (currently)
fn a() {}
fn b() {}
mod foo {
fn a() {}
fn b() {}
}
struct Foo;
impl Foo {
fn a() {}
fn b() {}
}
trait Bar {
fn a();
fn b();
}
After (what I think it should be formatted as)
fn a() {}
fn b() {}
mod foo {
fn a() {}
fn b() {}
}
struct Foo;
impl Foo {
fn a() {}
fn b() {}
}
trait Bar {
fn a();
fn b();
}
Related to #2954, also would be nice to have this https://github.com/rust-lang/rustfmt/issues/3382#issuecomment-793084299
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 running rustfmt with the shown rustfmt.toml settings against the Before example and compare the output with the requested formatting. Trace the blank_lines_lower_bound handling for functions inside mod, impl, and trait blocks; done means those functions receive the configured separation without changing the other demonstrated formatting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100