lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250603.223102.1013545444814279294.fujita.tomonori@gmail.com>
Date: Tue, 03 Jun 2025 22:31:02 +0900 (JST)
From: FUJITA Tomonori <fujita.tomonori@...il.com>
To: a.hindborg@...nel.org
Cc: aliceryhl@...gle.com, fujita.tomonori@...il.com,
 rust-for-linux@...r.kernel.org, boqun.feng@...il.com, frederic@...nel.org,
 lyude@...hat.com, tglx@...utronix.de, anna-maria@...utronix.de,
 jstultz@...gle.com, sboyd@...nel.org, ojeda@...nel.org,
 alex.gaynor@...il.com, gary@...yguo.net, bjorn3_gh@...tonmail.com,
 benno.lossin@...ton.me, tmgross@...ch.edu, dakr@...nel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 1/5] rust: time: Change Delta methods to take &self
 instead of self

On Mon, 02 Jun 2025 14:19:38 +0200
Andreas Hindborg <a.hindborg@...nel.org> wrote:

> "Alice Ryhl" <aliceryhl@...gle.com> writes:
> 
>> On Sun, May 04, 2025 at 01:59:54PM +0900, FUJITA Tomonori wrote:
>>> Change several methods of the `Delta` type in Rust to take `&self`
>>> instead of `self`. These methods do not mutate or consume the `Delta`
>>> value and are more idiomatically expressed as taking a shared
>>> reference. This change improves consistency with common Rust practice
>>> and allows calling these methods on references without requiring an
>>> explicit copy or move of the value.
>>
>> For small values that can be freely copied, I actualy think that using
>> `self` is more common Rust practice.
> 
> Besides best practice, the value will pass in a register. There is no
> benefit at all from passing a reference here and no improved ergonomics
> from using a reference.

Yeah, but somehow I thought that using &self is more common practice
in Rust.

I'll drop this patch in the next version.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ