[PATCH v5 04/23] rust: add new `num` module with `PowerOfTwo` type
Miguel Ojeda
miguel.ojeda.sandonis at gmail.com
Sun Jun 15 13:32:33 UTC 2025
On Thu, Jun 12, 2025 at 4:02 PM Alexandre Courbot <acourbot at nvidia.com> wrote:
>
> + /// assert_eq!(PowerOfTwo::<u32>::try_new(16).unwrap().value(), 16);
By the way, we are trying to write examples close to normal kernel
code as possible, so could you please use `?` here instead of
`unwrap()`?
It is not a big deal, when within `assert`s, but there is value in not
showing any `unwrap()`s, and to spot easily places where we actually
do `unwrap()`.
Also, please use intra-doc links wherever they may work, e.g. I think
[`PowerOfTwo`] and [`None`] will work.
Thanks!
Cheers,
Miguel
More information about the dri-devel
mailing list