-
Notifications
You must be signed in to change notification settings - Fork 925
Indentation of assignment RHS after one-line comment #4502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Generally agreed, though note that the comment should be correctly indented as well: let after =
// after_comment
if true {
1.0
}; |
Following is another related test case (from #4518) when using fn main() {
let x =
// Comment
777;
} is formatted as: fn main() {
let x =
// Comment
777;
} |
This is the current format output. An extra space is added before the |
Gotcha, thanks for the clarification |
* Fix #4502 issue - assignment indentation after one line comment * Enhancement by using rewrite_assign_rhs_with_comments() * Changes per comments received
* Fix rust-lang#4502 issue - assignment indentation after one line comment * Enhancement by using rewrite_assign_rhs_with_comments() * Changes per comments received
* Fix #4502 issue - assignment indentation after one line comment * Enhancement by using rewrite_assign_rhs_with_comments() * Changes per comments received
Output
Current expected formatting output from tests/target/issue-3851.rs
Expected output
To be compatible with other formatting, the desired output may be with the
if
statement indented to the right:For example, following is current formatting output of similar expression:
The text was updated successfully, but these errors were encountered: