rustfmt icon indicating copy to clipboard operation
rustfmt copied to clipboard

Comment removed inside constant expression

Open slyrz opened this issue 10 years ago • 0 comments

rustfmt (0.4.1) turns the following code

const FLAG_A: u32 = 1 << 1;
const FLAG_B: u32 = 1 << 2;
const FLAG_C: u32 = 1 << 3;

const SOME_CONSTANT: u32 =
    // Explanation why SOME_CONSTANT needs FLAG_A to be set.
    FLAG_A |
    // Explanation why SOME_CONSTANT needs FLAG_B to be set.
    FLAG_B |
    // Explanation why SOME_CONSTANT needs FLAG_C to be set.
    FLAG_C;

into

const FLAG_A: u32 = 1 << 1;
const FLAG_B: u32 = 1 << 2;
const FLAG_C: u32 = 1 << 3;

const SOME_CONSTANT: u32 = FLAG_A |
    // Explanation why SOME_CONSTANT needs FLAG_B to be set.
    FLAG_B |
    // Explanation why SOME_CONSTANT needs FLAG_C to be set.
    FLAG_C;

Issues that might be related: #21, #283

slyrz avatar May 06 '16 09:05 slyrz