Skip to content

Rustfmt fails to fmt #4135

@jyn514

Description

@jyn514

Consider the following code:

impl S {
    fn f() {
        self.g(
            {
                if b {
                    Err(w(
                        i(
                            "expected float or integer types for both operands of {}, got '{}' and '{}'",
                            token,
                        )), left)
                }
                match d {
                    _ => h(m,b), 
                }
            },
        )
    }
}

There are many style issues, but the one that caught my attention was the lack of a space after the comma. I tried and sure enough if you add a trailing space rustfmt will refuse to format at all and give an internal error as a result:

error[internal]: left behind trailing whitespace
  --> /home/joshua/src/rust/rcc/comma.rs:13:13:32
   |
13 |                     _ => h(m,b), 
   |                                 ^

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions