Skip to content

Multi-line expressions on both sides of an assignment shouldn't wrap to the same indent level #189

Open
rust-lang/rust
#119838

Description

I discovered this issue in some code I'm working on, and constructed this sample to match the issue I observed:

impl SomeType {
    fn method(&mut self) {
        self.array[array_index as usize]
            .as_mut()
            .expect("thing must exist")
            .extra_info = Some(ExtraInfo {
            parent,
            count: count as u16,
            children: children.into_boxed_slice(),
        });
    }
}

The fields of ExtraInfo should not be wrapping to the same indent level as the method chain. I can imagine a few ways to format this better, and don't feel strongly about which one, just that this definitely isn't the right formatting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions