Skip to content

where clauses in GAT impls aren't formatted #5580

Closed
@clarfonthey

Description

@clarfonthey

Playground example: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=1ef166f9e2b31f3f4093728719de4efc

pub trait Test {
    type Ref<'a> where Test: 'a;
}

impl<T, U> Test for (T,) {
    type Ref<'a> = (&'a T,) where T: 'a;
}

impl<T, U> Test for (T, U) {
    type Ref<'a> = (&'a T, &'a U) where T: 'a, U: 'a;
}

The above autoformats to:

pub trait Test {
    type Ref<'a>
    where
        Test: 'a;
}

impl<T, U> Test for (T,) {
    type Ref<'a> = (&'a T,) where T: 'a;
}

impl<T, U> Test for (T, U) {
    type Ref<'a> = (&'a T, &'a U) where T: 'a, U: 'a;
}

You'll notice that the where clauses for the impls aren't formatted at all, whereas I would expect:

pub trait Test {
    type Ref<'a>
    where
        Test: 'a;
}

impl<T, U> Test for (T,) {
    type Ref<'a> = (&'a T,)
    where
        T: 'a;
}

impl<T, U> Test for (T, U) {
    type Ref<'a> = (&'a T, &'a U)
    where
        T: 'a,
        U: 'a;
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions