[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87zfef27to.fsf@kernel.org>
Date: Tue, 10 Jun 2025 13:24:48 +0200
From: Andreas Hindborg <a.hindborg@...nel.org>
To: "FUJITA Tomonori" <fujita.tomonori@...il.com>
Cc: <alex.gaynor@...il.com>, <ojeda@...nel.org>, <aliceryhl@...gle.com>,
<anna-maria@...utronix.de>, <bjorn3_gh@...tonmail.com>,
<boqun.feng@...il.com>, <dakr@...nel.org>, <frederic@...nel.org>,
<gary@...yguo.net>, <jstultz@...gle.com>,
<linux-kernel@...r.kernel.org>, <lossin@...nel.org>,
<lyude@...hat.com>, <rust-for-linux@...r.kernel.org>,
<sboyd@...nel.org>, <tglx@...utronix.de>, <tmgross@...ch.edu>
Subject: Re: [PATCH v2 1/5] rust: time: Rename Delta's methods from as_* to
into_*
"FUJITA Tomonori" <fujita.tomonori@...il.com> writes:
> Rename Delta's methods that take self from as_* to into_* to align
> with Rust naming conventions.
>
> Using `self` is more common Rust practice for small values that can be
> freely copied [1].
>
> Clippy warns against using as_* names for trait methods that take self
> as follows:
>
> warning: methods called as_* usually take self by reference or self by mutable reference
> --> ~/linux/rust/kernel/time/hrtimer.rs:421:17
> |
> 421 | fn as_nanos(self) -> i64;
>
> Rename the `Delta` struct's methods from as_nanos(), as_micros_ceil(),
> and as_millis() to into_nanos(), into_micros_ceil(), and
> into_millis(), respectively to maintain consistency with the other
> function names.
>
> Link: https://lore.kernel.org/lkml/aD1fgizC4FPT07vt@google.com/ [1]
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@...il.com>
Reviewed-by: Andreas Hindborg <a.hindborg@...nel.org>
Best regards,
Andreas Hindborg
Powered by blists - more mailing lists