rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Hindborg <a.hindborg@kernel.org>
To: "FUJITA Tomonori" <fujita.tomonori@gmail.com>
Cc: <alex.gaynor@gmail.com>,  <ojeda@kernel.org>,
	 <aliceryhl@google.com>, <anna-maria@linutronix.de>,
	 <bjorn3_gh@protonmail.com>, <boqun.feng@gmail.com>,
	 <dakr@kernel.org>,  <frederic@kernel.org>, <gary@garyguo.net>,
	 <jstultz@google.com>, <linux-kernel@vger.kernel.org>,
	 <lossin@kernel.org>, <lyude@redhat.com>,
	 <rust-for-linux@vger.kernel.org>, <sboyd@kernel.org>,
	 <tglx@linutronix.de>,  <tmgross@umich.edu>
Subject: Re: [PATCH v2 1/5] rust: time: Rename Delta's methods from as_* to into_*
Date: Tue, 10 Jun 2025 13:24:48 +0200	[thread overview]
Message-ID: <87zfef27to.fsf@kernel.org> (raw)
In-Reply-To: <20250609102418.3345792-2-fujita.tomonori@gmail.com> (FUJITA Tomonori's message of "Mon, 09 Jun 2025 19:24:14 +0900")

"FUJITA Tomonori" <fujita.tomonori@gmail.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@gmail.com>


Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org>


Best regards,
Andreas Hindborg




  reply	other threads:[~2025-06-10 11:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-09 10:24 [PATCH v2 0/5] rust: time: Convert hrtimer to use Instant and Delta FUJITA Tomonori
2025-06-09 10:24 ` [PATCH v2 1/5] rust: time: Rename Delta's methods from as_* to into_* FUJITA Tomonori
2025-06-10 11:24   ` Andreas Hindborg [this message]
2025-06-09 10:24 ` [PATCH v2 2/5] rust: time: Replace HrTimerMode enum with trait-based mode types FUJITA Tomonori
2025-06-09 10:24 ` [PATCH v2 3/5] rust: time: Add HrTimerExpires trait FUJITA Tomonori
2025-06-10 11:24   ` Andreas Hindborg
2025-06-09 10:24 ` [PATCH v2 4/5] rust: time: Make HasHrTimer generic over HrTimerMode FUJITA Tomonori
2025-06-10 11:25   ` Andreas Hindborg
2025-06-10 12:12     ` FUJITA Tomonori
2025-06-09 10:24 ` [PATCH v2 5/5] rust: time: Remove Ktime in hrtimer FUJITA Tomonori

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=87zfef27to.fsf@kernel.org \
    --to=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=anna-maria@linutronix.de \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=frederic@kernel.org \
    --cc=fujita.tomonori@gmail.com \
    --cc=gary@garyguo.net \
    --cc=jstultz@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=lyude@redhat.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=sboyd@kernel.org \
    --cc=tglx@linutronix.de \
    --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).