Skip to content

Odd formatting of empty where clause #6488

Open
@joshlf

Description

@joshlf

The following is rustfmt's formatting on 2025-02-17 4d91de4e48 (the version currently on the Rust Playground):

impl<'a, T, I> Ptr<'a, T, I>
where
    T: 'a + TransparentWrapper<I, UnsafeCellVariance = Covariant> + ?Sized,
    I: Invariants,
{
    pub(crate) fn transparent_wrapper_into_inner(
        self,
    ) -> Ptr<
        'a,
        T::Inner,
        (
            I::Aliasing,
            <T::AlignmentVariance as AlignmentVariance<I::Alignment>>::Applied,
            <T::ValidityVariance as ValidityVariance<I::Validity>>::Applied,
        ),
    >
where {
    }
}

The where clause should probably be indented by four spaces.

Also note that, when wrapped in a module, the where clause is still not indented at all:

mod foo {
    impl<'a, T, I> Ptr<'a, T, I>
    where
        T: 'a + TransparentWrapper<I, UnsafeCellVariance = Covariant> + ?Sized,
        I: Invariants,
    {
        pub(crate) fn transparent_wrapper_into_inner(
            self,
        ) -> Ptr<
            'a,
            T::Inner,
            (
                I::Aliasing,
                <T::AlignmentVariance as AlignmentVariance<I::Alignment>>::Applied,
                <T::ValidityVariance as ValidityVariance<I::Validity>>::Applied,
            ),
        >
where {
        }
    }
}

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