jinxdash / prettier-plugin-rust

Prettier Rust is an opinionated code formatter that autocorrects bad syntax.
MIT License
178 stars 7 forks source link

attributes are inconsistently and incorrectly combined into the same line on enums with struct or function variants #32

Open bbugh opened 1 year ago

bbugh commented 1 year ago

Input code

#[derive(Error, Debug)]
enum Message {
    #[error("married order hunt twenty group lack known")]
    Quit,

    #[error("square sit center whether important")]
    Move { x: i32, y: i32 },

    #[error("thread wave since space sit own congress")]
    Write(String),

    #[error("tower blew high angry lovely everything")]
    ChangeColor(i32, i32, i32),
}

Output code

#[derive(Error, Debug)]
enum Message {
    #[error("married order hunt twenty group lack known")]
    Quit,

    #[error("square sit center whether important")] Move {
        x: i32,
        y: i32,
    },

    #[error("thread wave since space sit own congress")] Write(String),

    #[error("tower blew high angry lovely everything")] ChangeColor(i32, i32, i32),
}

Additional context

The formatting of this block should not change, as attributes should not be combined into the same line as the enum variant definition.