Rustfmt setting to avoid moving comment

⚓ Rust    📅 2025-05-13    👤 surdeus    👁️ 7      

surdeus

Warning

This post was published 100 days ago. The information described in this article may have changed.

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