Skip to content
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

Rustfmt should not indent multi-line comments's bodies #3827

Closed
Boscop opened this issue Oct 3, 2019 · 1 comment
Closed

Rustfmt should not indent multi-line comments's bodies #3827

Boscop opened this issue Oct 3, 2019 · 1 comment

Comments

@Boscop
Copy link

Boscop commented Oct 3, 2019

E.g. I often have the following situation when I want to comment out a method:

Before:

image

Since Sublime Text removes all trailing whitespace, I place the cursor in the empty line before the function, hold Shift, place the cursor in the empty line after the function, so that my text selection includes the whole method, then I do Ctrl+Shift+/ to toggle-multi-line comment the text selection, which results in this:

image

Then I do Ctrl+S to save the file and invoke RustFmt, which results in this:

image

It indented my outcommented method so that it's not aligned with my non-outcommented methods anymore.
Please don't do this. It'd be ok to just indent the lines containing only /* and */ but not the comment's body. But I'd prefer if it didn't indent these at all!

Can you show some cases where you think rustfmt should indent multi-line comments' bodies?
Then we could distinguish when it should and should not indent. I think at least when the comment starts and ends at zero indentation (column 0) it should leave it as it is.
E.g. cases like this would still be indented:

    fn foo(&self) {}

/* doesn't end at column 0 */

    fn bar(&self) {}

I'm using rustfmt 1.4.8-nightly (afb1ee1c 2019-09-08).

@ytmimi
Copy link
Contributor

ytmimi commented Jul 21, 2022

Closing as this is a duplicate of #1264

@ytmimi ytmimi closed this as not planned Won't fix, can't repro, duplicate, stale Jul 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants