From: Alistair Francis Date: Tue, 28 Apr 2026 13:10:50 +0000 (+0100) Subject: rust: pin-init: examples: mark as `#[inline]` all `From::from()`s for `Error` X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=be7ea321a2d3a3d4151c9304f50fa1fe26487a81;p=thirdparty%2Fkernel%2Flinux.git rust: pin-init: examples: mark as `#[inline]` all `From::from()`s for `Error` There was a recent request in kernel [1] to mark as `#[inline]` the simple `From::from()` functions implemented for `Error`. Thus mark all of the existing impl From<...> for Error { fn from(err: ...) -> Self { ... } } functions as `#[inline]`. While in pin-init crate the relevant code is just examples, it nevertheless does not hurt to use good practice for them. Suggested-by: Gary Guo Link: https://lore.kernel.org/all/8403c8b7a832b5274743816eb77abfa4@garyguo.net/ [1] Signed-off-by: Alistair Francis Reviewed-by: Gary Guo [ Reworded commit message - Gary ] Link: https://patch.msgid.link/20260428-pin-init-sync-v1-1-07f9bd3859fb@garyguo.net Signed-off-by: Gary Guo --- diff --git a/rust/pin-init/examples/error.rs b/rust/pin-init/examples/error.rs index 8f4e135eb8ba5..96f095398e8d5 100644 --- a/rust/pin-init/examples/error.rs +++ b/rust/pin-init/examples/error.rs @@ -11,6 +11,7 @@ use std::alloc::AllocError; pub struct Error; impl From for Error { + #[inline] fn from(e: Infallible) -> Self { match e {} } @@ -18,6 +19,7 @@ impl From for Error { #[cfg(feature = "alloc")] impl From for Error { + #[inline] fn from(_: AllocError) -> Self { Self }