Re: [PATCH v3 1/5] rust: task: add safe schedule_timeout() wrapper

From: FUJITA Tomonori

Date: Mon Nov 16 2026 - 19:45:56 EST


On Tue, 17 Nov 2026 01:14:42 +0100
Danilo Krummrich <dakr@xxxxxxxxxx> wrote:

> +pub fn schedule_timeout(timeout: Delta<Jiffy>) -> Delta<Jiffy> {
> + let timeout = timeout.as_jiffies().max(0);

In earlier reviews of my patches, Gary asked me to use the function
syntax or clamp() for this instead of the method syntax [1][2]:

let timeout = isize::max(timeout.as_jiffies(), 0);

[1] https://lore.kernel.org/rust-for-linux/DLMME4OBH3P8.3Q6UK95T2WGI@xxxxxxxxxxx/
[2] https://lore.kernel.org/rust-for-linux/DLUDG2TH77RI.ZQ0T5MH7Q573@xxxxxxxxxxx/