From: FUJITA Tomonori <tomo@flapping.org>
To: gary@garyguo.net
Cc: tomo@flapping.org, a.hindborg@kernel.org, ojeda@kernel.org,
acourbot@nvidia.com, aliceryhl@google.com,
anna-maria@linutronix.de, bjorn3_gh@protonmail.com,
boqun@kernel.org, dakr@kernel.org, daniel.almeida@collabora.com,
frederic@kernel.org, jstultz@google.com, lossin@kernel.org,
lyude@redhat.com, sboyd@kernel.org, tamird@kernel.org,
tglx@kernel.org, tmgross@umich.edu, work@onurozkan.dev,
rust-for-linux@vger.kernel.org, fujita.tomonori@gmail.com
Subject: Re: [PATCH v3 2/2] rust: time: add Delta::to_jiffies_timeout() for timeout conversion
Date: Fri, 25 Sep 2026 08:33:15 +0900 (JST) [thread overview]
Message-ID: <20260925.083315.1383506554290485158.tomo@flapping.org> (raw)
In-Reply-To: <DLMME4OBH3P8.3Q6UK95T2WGI@garyguo.net>
On Wed, 23 Sep 2026 11:22:47 +0100
"Gary Guo" <gary@garyguo.net> wrote:
>> + // CAST: `max()` makes the value non-negative, so the cast keeps it.
>> + let nsecs = self.as_nanos().max(0) as u64;
>
> Please use fn syntax and have `core::cmp::max(self.as_nanos(), 0)` or
> `u64::max(..)`. Due to the method syntax hinting some action is taking place,
> many people find it confusing, because you can easily understand `.max` it as
> "clamp to a max of" while it actually means "clamp to a min of".
>
> See https://internals.rust-lang.org/t/am-i-the-only-one-confused-by-a-min-b-and-a-max-b/13252
Makes sense. Fixed in v4:
https://lore.kernel.org/all/20260924232530.446588-1-tomo@flapping.org/
Thanks for reviewing the patches!
next prev parent reply other threads:[~2026-09-24 23:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <ecZSyn5iOGZxLQdeadMYD0WYwv1yJFnIc0PLl8ULc8k4LJrT2wwo1dn9jSFXDORi20jKY0IpvWoVxrNZsSaOnQ==@protonmail.internalid>
2026-09-08 23:04 ` [PATCH v3 0/2] Add Delta::to_jiffies_timeout() FUJITA Tomonori
2026-09-08 23:04 ` [PATCH v3 1/2] rust: bindings: set HZ to CONFIG_HZ FUJITA Tomonori
2026-09-23 10:22 ` Gary Guo
2026-09-08 23:04 ` [PATCH v3 2/2] rust: time: add Delta::to_jiffies_timeout() for timeout conversion FUJITA Tomonori
2026-09-23 10:22 ` Gary Guo
2026-09-24 23:33 ` FUJITA Tomonori [this message]
2026-09-23 8:22 ` [PATCH v3 0/2] Add Delta::to_jiffies_timeout() Andreas Hindborg
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=20260925.083315.1383506554290485158.tomo@flapping.org \
--to=tomo@flapping.org \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=aliceryhl@google.com \
--cc=anna-maria@linutronix.de \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=frederic@kernel.org \
--cc=fujita.tomonori@gmail.com \
--cc=gary@garyguo.net \
--cc=jstultz@google.com \
--cc=lossin@kernel.org \
--cc=lyude@redhat.com \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=sboyd@kernel.org \
--cc=tamird@kernel.org \
--cc=tglx@kernel.org \
--cc=tmgross@umich.edu \
--cc=work@onurozkan.dev \
/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