On 11/3/2025 6:50 PM, Alexandre Courbot wrote:
> On Tue Nov 4, 2025 at 5:04 AM JST, Joel Fernandes wrote:
>> Hi Alex,
>> Nice improvement, a nit:
>>
>> On Wed, Oct 29, 2025 at 12:07:37AM +0900, Alexandre Courbot wrote:
>> [..]
>>> impl PmuLookupTable {
>>> fn new(dev: &device::Device, data: &[u8]) -> Result<Self> {
>>> - if data.len() < 4 {
>>> - return Err(EINVAL);
>>> - }
>>> + let header = PmuLookupTableHeader::from_bytes_copy_prefix(data)
>>> + .ok_or(EINVAL)?
>>> + .0;
>>
>> Can we change to the following, it is easier to read than using `.0` IMO.
>>
>> let (header, _rest) = PmuLookupTableHeader::from_bytes_copy_prefix(data)
>> .ok_or(EINVAL)?;
>>
>> (and similarly in the other patches).
>
> We can use `let (header, _) =` to make sure the unused remainder is not
> bound to any variable. That also turns that statement into a one-liner.
>
Perfect, that's even better, thanks!
- Joel
- [PATCH 0/5] gpu: nova-core: leverage FromBytes for VBIOS... Alexandre Courbot
- [PATCH 1/5] rust: transmute: add `from_bytes_prefix... Alexandre Courbot
- [PATCH 2/5] gpu: nova-core: vbios: use FromBytes fo... Alexandre Courbot
- Re: [PATCH 2/5] gpu: nova-core: vbios: use From... Joel Fernandes
- Re: [PATCH 2/5] gpu: nova-core: vbios: use ... Alexandre Courbot
- Re: [PATCH 2/5] gpu: nova-core: vbios: ... Joel Fernandes
- [PATCH 3/5] gpu: nova-core: vbios: use FromBytes fo... Alexandre Courbot
- [PATCH 4/5] gpu: nova-core: vbios: use FromBytes fo... Alexandre Courbot
- [PATCH 5/5] gpu: nova-core: vbios: use FromBytes fo... Alexandre Courbot
- Re: [PATCH 0/5] gpu: nova-core: leverage FromBytes ... John Hubbard
- Re: [PATCH 0/5] gpu: nova-core: leverage FromBy... Alexandre Courbot
- Re: [PATCH 0/5] gpu: nova-core: leverage Fr... John Hubbard
- Re: [PATCH 0/5] gpu: nova-core: leverage FromBytes ... Joel Fernandes
- Re: [PATCH 0/5] gpu: nova-core: leverage FromBytes ... Alexandre Courbot
