Re: [PATCH] block, rust: simplify validate_block_size() function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Aug 31, 2024 at 10:13 PM Alexey Dobriyan <adobriyan@xxxxxxxxx> wrote:
>
> Why do they duplicate the code 1:1?

I am not sure I understand your question. Documentation establishes
what a function is expected to do. Code implements the function.
Callers should not need to reverse engineer the design/code to take
advantage of a function.

Yes, in some cases, it may be trivial to infer what the function is
supposed to do by reading its implementation, and thus documentation
may seem redundant. But even in simple cases, one still needs to
assume the implementation has no bugs in order to do that. And in
non-trivial cases, the documentation is even more valuable.

It is true that in many places in the kernel there is not much code
documentation. However, for Rust code, we are trying to improve on
that.

Cheers,
Miguel





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux