Skip to content

Rustfmt changing the meaning of && by removing whitespace #1702

Closed
@SamWhited

Description

@SamWhited

I have something similar to the following:

        if match foo(bar) {
            Err(_) => false,
            Ok(p) => { // p is a 3-tuple: (Option<&str>, &str, Option<&str>)
                match p.0 {
                    None => self.local.is_none(),
                    Some(s) => self.local.is_some() && self.local.unwrap() == s,
                }
                && p.1 == self.domain &&
                    match p.2 {
                        None => self.resource.is_none(),
                        Some(s) => self.resource.is_some() && self.resource.unwrap() == s,
                    }
            }
        }
        {

Rustfmt currently formats one line as:

                &&p.1 == self.domain &&

and now building complains that I am trying to compare an &&&str (rustfmt removed the space between the && and the p.1).

Running rustfmt 0.9.0-nightly for 2016-06-15.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugPanic, non-idempotency, invalid code, etc.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions