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

Strange comment formatting #3937

Closed
ghost opened this issue Nov 22, 2019 · 2 comments
Closed

Strange comment formatting #3937

ghost opened this issue Nov 22, 2019 · 2 comments

Comments

@ghost
Copy link

ghost commented Nov 22, 2019

$ rustfmt --version
rustfmt 1.4.9-nightly (33e3667 2019-10-07)

Code:

struct Foo {
    // a: i32,
    //
    // b: i32,
}

Formatting with rustfmt foo.rs:

struct Foo {
    // a: i32,
//
// b: i32,
}

I expected rustfmt to leave the code unmodified.


Code:

struct Foo {
    a: i32,
    //
    // b: i32,
}

Formatting with rustfmt format_code_in_doc_comments=true src/foo.rs:

struct Foo {
    a: i32,
    /*
     * b: i32, */
}

I expected rustfmt to leave the code unmodified.

@pickfire
Copy link

Maybe off-topic, I just wonder if I should create a new issue (or I am lazy).

/// Hello
/// world.

Should be formatted as

/// Hello world.

But if the sentence already ends.

/// Hello.
/// World.

Then it should be the same. Other languages may need to be checked as well.

@ytmimi
Copy link
Contributor

ytmimi commented Apr 9, 2022

Going to close this as #5171 fixes the indentation for empty struct comments and #5091 fixes the format_code_in_doc_comments=true issue.

@ytmimi ytmimi closed this as completed Apr 9, 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