From: Andrew Lunn <andrew@lunn.ch>
To: Thorsten Blum <thorsten.blum@linux.dev>
Cc: "FUJITA Tomonori" <fujita.tomonori@gmail.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Heiner Kallweit" <hkallweit1@gmail.com>,
"Russell King" <linux@armlinux.org.uk>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Danilo Krummrich" <dakr@kernel.org>,
netdev@vger.kernel.org, rust-for-linux@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] rust: net::phy inline if expressions to improve read_status
Date: Fri, 19 Sep 2025 17:16:17 +0200 [thread overview]
Message-ID: <43490b38-5d8c-4dfc-a37a-8f34f99e2d3c@lunn.ch> (raw)
In-Reply-To: <A17B492B-0EAD-4CCE-9889-6D559401D3D3@linux.dev>
> There's obviously nothing wrong with local variables. This patch is not
> about performance improvements, but writing consistent and idiomatic
> Rust code.
>
> Currently, dev.set_duplex() uses a local variable and is called once,
> whereas dev.set_speed() doesn't use a local variable and is called
> twice.
I would suggest the opposite change if you want to make the code
consistent:
let speed = if ret & BMCR_SPEED100 != 0 {
uapi::SPEED_100
} else {
uapi::SPEED_10
}
dev.set_speed(speed)
Andrew
prev parent reply other threads:[~2025-09-19 15:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-19 11:20 [PATCH net-next] rust: net::phy inline if expressions to improve read_status Thorsten Blum
2025-09-19 12:54 ` Andrew Lunn
2025-09-19 13:30 ` Thorsten Blum
2025-09-19 15:16 ` Andrew Lunn [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43490b38-5d8c-4dfc-a37a-8f34f99e2d3c@lunn.ch \
--to=andrew@lunn.ch \
--cc=a.hindborg@kernel.org \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fujita.tomonori@gmail.com \
--cc=gary@garyguo.net \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=lossin@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=pabeni@redhat.com \
--cc=rust-for-linux@vger.kernel.org \
--cc=thorsten.blum@linux.dev \
--cc=tmgross@umich.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).