OR condition is not formatted
Open
Nobody has claimed this yet.
A-binary-ops
A-comments
I-poor-formatting
P-medium
S-duplicate
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
Sample code:
fn main() {
/* Common case: The double precision result is fine. */
if (ui & 0x1fffffff) != 0x10000000 /* not a halfway case */
|| e == 0x7ff /* NaN */
|| (result - xy == z as f64 && result - z as f64 == xy) /* exact */
|| fegetround() != FE_TONEAREST
/* not round-to-nearest */
{}
}
What I expect:
fn main() {
/* Common case: The double precision result is fine. */
if (ui & 0x1fffffff) != 0x10000000 /* not a halfway case */
|| e == 0x7ff /* NaN */
|| (result - xy == z as f64 && result - z as f64 == xy) /* exact */
|| fegetround() != FE_TONEAREST /* not round-to-nearest */
{
}
}
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 reproducing the supplied Rust example and comparing the current formatting with the expected output. Trace the formatter path responsible for multiline if conditions and OR expressions; done means the comments remain correctly placed and each || condition is formatted as shown.
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
- Mostly clear
- Newbie friendliness
- 35/100