Comment indentation on opening line of a block is incorrect
@topecongiro is already working on this.
Since Jan 14, 2020.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
Similar to the just-filed #3254 but a different case and with a possibly different resolution, the following comment is re-indented incorrectly:
if foo { // this comment describes the entire block
let x = y();
}
Which incorrectly interprets the comment as belonging within the if statement, which is
technically correct only in the most pedantic sense, as to human programmers (an admittedly slowly
dying species) it is fairly clear that the comment (regardless of its contents) describes the preceding
contents of the line and does not belong inside the block:
if foo {
// this comment describes the entire block
let x = y();
}
As now the comment appears to describe the first line of the block (let x = y();) and not the
block itself. This should either not be reformatted or it should be reformatted to the following:
// this comment describes the entire block
if foo {
let x = y();
}
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.
Assessment
This issue has not been assessed yet.