Line break missing with indent_style = "Visual"
Open
Nobody has claimed this yet.
I-poor-formatting
only-with-option
P-low
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
The following code is formatted as follows with rustfmt 1.4.11-nightly (1838235 2019-12-03) and also rustfmt 2.0.0-rc.1-nightly (facba6a5 2020-01-14):
fn main() {
let global_manager = GlobalManager::new_with_cb(&display,
global_filter!([WlSeat,
2,
move |seat: Main<WlSeat>, _: DispatchData| {
let seat_data =
RefCell::new(SeatData::default());
seat.as_ref()
.user_data()
.set(move || seat_data);
seat.quick_assign(seat_handler);
seats_2.borrow_mut().push(seat);
}]));
}
Looks like it forgets to break the line after =, inserting the line break gives the desired result:
fn main() {
let global_manager =
GlobalManager::new_with_cb(&display,
global_filter!([WlSeat,
2,
move |seat: Main<WlSeat>, _: DispatchData| {
let seat_data =
RefCell::new(SeatData::default());
seat.as_ref()
.user_data()
.set(move || seat_data);
seat.quick_assign(seat_handler);
seats_2.borrow_mut().push(seat);
}]));
}
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
Reproduce the issue with the provided Rust snippet using rustfmt 1.4.11-nightly or 2.0.0-rc.1-nightly and the Visual indentation style. Trace the formatting path for the assignment and nested function call; done means rustfmt inserts the line break after = and matches the desired output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100