[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANiq72=Jzr4SUH3G5AWS4iLoN7o5gM5s6+K_Y-fJk5uuFnMDwg@mail.gmail.com>
Date: Sat, 17 Jan 2026 15:25:52 +0100
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Onur Özkan <work@...rozkan.dev>
Cc: Greg KH <gregkh@...uxfoundation.org>, rust-for-linux@...r.kernel.org,
rafael@...nel.org, dakr@...nel.org, ojeda@...nel.org, boqun.feng@...il.com,
gary@...yguo.net, bjorn3_gh@...tonmail.com, lossin@...nel.org,
a.hindborg@...nel.org, aliceryhl@...gle.com, tmgross@...ch.edu,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/1] rust: simplify `Adapter::id_info`
On Sat, Jan 17, 2026 at 12:03 PM Onur Özkan <work@...rozkan.dev> wrote:
>
> I don't know what "rust golf" means, the main motivation here was to use
> a more idiomatic Rust pattern.
I have seen some patches recently arguing certain methods being more
idiomatic etc.
I would like to caution that the fact that a method exists doesn't
make it a good idea to automatically apply it in every case, and I
don't think using a maximally functional style is actually idiomatic
in Rust to begin with.
Even if it were actually more idiomatic, the idiomatic argument isn't
very strong anyway, i.e. what matters is making the code look best,
and the change needs to be a fair improvement -- otherwise it may not
be worth it to shuffle the code around etc.
In this particular instance, it is a significant reduction in lines,
indeed, but I don't think the original code is "annoying" at all -- it
was already easy to follow.
In general, I think authors and maintainers should pick whatever style
they think suits best for each situation, since both can be overdone.
Cheers,
Miguel
Powered by blists - more mailing lists