Re: [PATCH v2] rust: list: Add unsafe for container_of
From: Philipp Stanner
Date: Tue Nov 18 2025 - 04:37:27 EST
On Tue, 2025-11-18 at 10:00 +0100, Miguel Ojeda wrote:
> On Tue, Nov 18, 2025 at 9:30 AM Philipp Stanner <phasta@xxxxxxxxxxx> wrote:
> >
> > It's absolutely common to provide it. If you feel better without it, I
> > can omit it, I guess.
>
> No, it is not "absolutely common" to provide it in a case like this,
> and it is not about "feeling better" either.
It *is* absolutely common, or at least frequent, and you are the first
guy in the entire project I ever heard complaining about it. Maybe it
is often used wrongly or unnecessarily, though.
But no worries, be assured that I will take this detail into account
when working with you.
>
> > I ran rustfmt.
>
> Yes, but this is a macro -- `rustfmt` is likely not formatting that
> code. In formatted code, there are no multiline `unsafe` blocks that
> contain code after the opening brace, so it looks off.
So why then do you even suggest running rustfmt? How should I make it
check the formatting?