Re: [PATCH v3 04/10] rust: uaccess: add UserSliceWriter::write_slice_partial()
From: Miguel Ojeda
Date: Tue Oct 28 2025 - 09:57:40 EST
On Thu, Oct 23, 2025 at 10:33 AM Alice Ryhl <aliceryhl@xxxxxxxxxx> wrote:
>
> Isn't it more readable to write it like this?
>
> let Some(src) = data.get(offset..end) else {
> return Ok(0);
> };
>
> self.write_slice(src)?;
> Ok(src.len())
Yeah, I also tend to prefer that style for things like this, because
the "main" operation (like forwarding to `write_slice()`) is at the
top-level. rather than deep in a closure. Plus early returns look
closer to C.
Cheers,
Miguel