Rustfmt: Incorrect whitespace when match_arm_blocks set to false

Created on 7 Jan 2020  路  1Comment  路  Source: rust-lang/rustfmt

When the config option for match_arm_blocks is set to false, the formatter adds additional whitespace which causes errors saying: 'error[internal]: left behind trailing whitespace'

For example:

match pos_iter.peek()
    {
        Some(pos) if pos.0 != 0 =>
            add_paragraphs_to_map(&doc[0..pos.0], 0, current_level, &mut paragraphs),
        None => add_paragraphs_to_map(doc, 0, current_level, &mut paragraphs),
        _ => (),
    }

// becomes

match pos_iter.peek()
    {
        Some(pos) if pos.0 != 0 =>

            add_paragraphs_to_map(&doc[0..pos.0], 0, current_level, &mut paragraphs),
        None => add_paragraphs_to_map(doc, 0, current_level, &mut paragraphs),
        _ => (),
    }
bug only-with-option

Most helpful comment

This issue was discussed briefly in Discord, and confirmed to be reproducible on master as well

>All comments

This issue was discussed briefly in Discord, and confirmed to be reproducible on master as well

Was this page helpful?
0 / 5 - 0 ratings