]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rust: make `Arc::into_unique_or_drop` associated function
authorGary Guo <gary@garyguo.net>
Fri, 5 Sep 2025 04:41:38 +0000 (21:41 -0700)
committerPeter Zijlstra <peterz@infradead.org>
Mon, 15 Sep 2025 07:38:35 +0000 (09:38 +0200)
commit7487645f0b2d1a30590bafa7a977dc6661006d4f
treeee25c7b45a11c5b5f1f52c879cdf28dce80e1148
parentbb38f35b35f9de0cebc4d62ea73482454e38cef3
rust: make `Arc::into_unique_or_drop` associated function

Make `Arc::into_unique_or_drop` to become a mere associated function
instead of a method (i.e. removing the `self` receiver).

It's a general convention for Rust smart pointers to avoid having
methods defined on them, because if the pointee type has a method of the
same name, then it is shadowed. This is normally for avoiding semver
breakage, which isn't an issue for kernel codebase, but it's still
generally a good practice to follow this rule, so that `ptr.foo()` would
always be calling a method on the pointee type.

Signed-off-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Benno Lossin <lossin@kernel.org>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Elle Rhumsaa <elle@weathered-steel.dev>
Link: https://lore.kernel.org/r/20250723233312.3304339-3-gary@kernel.org
rust/kernel/sync/arc.rs