Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Odd formatting of empty where clause #6488

Open
joshlf opened this issue Feb 25, 2025 · 0 comments
Open

Odd formatting of empty where clause #6488

joshlf opened this issue Feb 25, 2025 · 0 comments

Comments

@joshlf
Copy link

joshlf commented Feb 25, 2025

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 {
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants