From 90f30deb5429dbbf3a1d20621d8f9f44c5132b9c Mon Sep 17 00:00:00 2001 From: Alistair Francis Date: Wed, 25 Mar 2026 10:16:56 +1000 Subject: [PATCH] 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 [ Reworded commit message - Gary ] Signed-off-by: Gary Guo --- examples/error.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/error.rs b/examples/error.rs index 8f4e135e..96f09539 100644 --- a/examples/error.rs +++ b/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 }