Re: [PATCH 02/13] rust: init: simplify from `map_err` to `inspect_err`

Alice Ryhl
2024-07-02T12:27:59Z

On Mon, Jul 1, 2024 at 11:58 PM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> On Mon, Jul 1, 2024 at 10:05 PM Björn Roy Baron
> <bjorn3_gh@protonmail.com> wrote:
> >
> > The formatting here is a bit weird. I would have expected the ) ending the inspect_err call to be placed on a new line given that the unsafe block isn't placed on the same line as the start of the inspect_err call either. This seems to be a case where rustfmt mostly gives up on formatting. If I deindent the comment and unsafe block rustfmt will keep it that way and if I add a trailing space to the inspect_err line it will keep it and emit an error that it left behind trailing whitespace. Maybe add a block around the comment and unsafe block to make rustfmt work again?
>
> Benno: any preference here? Or even open coding it.

I would open code it with an `if res.is_err() { drop }`. Using inspect
for a side effect other than printing seems weird to me.

Alice