rust-lang / rust-lang/rust-mode
Incorrect indentation of `if` when no parens are used
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
Steps to reproduce
- In
rust-modeinsert the code below:fn foo() { if (foo && bar) { true; } } fn foo() { if foo && bar { true; } } - Try to indent it.
Expected
The line true in both paragraphs has the same offset
Actual
The line true has different offset in one and another paragraph
Additional information
Tested on 20210423 version in Elpa as well as the latest code in repo as of 494d59f commit.
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 two Rust snippets in rust-mode and compare how indentation is calculated for the parenthesized and unparenthesized conditions. Trace the rust-mode indentation entry point responsible for those lines, then verify that both examples indent the true line at the same offset.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- emacs, emacs-lisp, rust
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100