Skip to content

Inconsistent line breaks in match #3963

Closed
@EverlastingBugstopper

Description

@EverlastingBugstopper

What I expect:

impl fmt::Display for RemoteObject {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        match &self.object_type {
            RemoteObjectType::Undefined => write!(f, "undefined"),
            RemoteObjectType::Boolean 
            | RemoteObjectType::String => self.display_value(f),
            RemoteObjectType::Null 
            | RemoteObjectType::Object => self.display_object(f),
            RemoteObjectType::BigInt
            | RemoteObjectType::Number
            | RemoteObjectType::Symbol
            | RemoteObjectType::Function => self.display_description(f),
        }
    }
}

What rustfmt produces:

impl fmt::Display for RemoteObject {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        match &self.object_type {
            RemoteObjectType::Undefined => write!(f, "undefined"),
            RemoteObjectType::Boolean | RemoteObjectType::String => self.display_value(f),
            RemoteObjectType::Null | RemoteObjectType::Object => self.display_object(f),
            RemoteObjectType::BigInt
            | RemoteObjectType::Number
            | RemoteObjectType::Symbol
            | RemoteObjectType::Function => self.display_description(f),
        }
    }
}

If this isn't a bug - happy to close! Might just be a personal preference of mine :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions