rust-lang / rust-lang/rust-mode
Indentation for `fn` body misaligned when `(` is on next line
Open
Nobody has claimed this yet.
indentation
- Dominant language
- Emacs Lisp
- Stars
- 1.3k
- Forks
- 198
- PR merge metrics
- No merged PRs in 30d
Description
The fn body here indents as shown:
pub fn build_lane_table_states<'grammar>
(grammar: &'grammar Grammar,
start: NonterminalString)
-> Result<Vec<LR1State<'grammar>>, LR1TableConstructionError<'grammar>> {
let (lr0_states, lr0_conflicts) = match build::build_lr0_states(grammar, start) {
Ok(s) => (s, vec![]),
Err(e) => (e.states, e.conflicts),
};
unimplemented!()
}
But I would expect:
pub fn build_lane_table_states<'grammar>
(grammar: &'grammar Grammar,
start: NonterminalString)
-> Result<Vec<LR1State<'grammar>>, LR1TableConstructionError<'grammar>> {
let (lr0_states, lr0_conflicts) = match build::build_lr0_states(grammar, start) {
Ok(s) => (s, vec![]),
Err(e) => (e.states, e.conflicts),
};
unimplemented!()
}
The trigger is definitely having the open paren on the next line. Admittedly, I wouldn't ordinarily write a fn this way, but it is produced by rustfmt in some cases.
Contributor guide
No contributing guide indexed for this repository
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 reported indentation with the Rust snippet in rust-mode, focusing on a function whose opening parenthesis is on the next line. No implementation file or test is named; trace the indentation entry point and add coverage showing the body aligns with the expected example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- emacs-lisp, rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100