Rustfmt setting to avoid moving comment

⚓ rust    📅 2025-05-13    👤 surdeus    👁️ 3      

surdeus

I have something like this:

pub enum SomeEnum {
    // Comment 1
    SomeThing(String)
    // Comment 2
}

When I run cargo +nightly fmt it moves that last comment to the previous line:

pub enum SomeEnum {
    // Comment 1
    SomeThing(String) // Comment 2
}

Is there a setting I can change so it doesn't do that?

1 post - 1 participant

Read full topic

🏷️ rust_feed