From 7a5716446787fe2cf58dccbc342b53bb181ab1f9 Mon Sep 17 00:00:00 2001 From: Alistair Francis Date: Wed, 25 Mar 2026 10:16:56 +1000 Subject: [PATCH] rust: Mark all from() for Error functions inline Mark all of the existing impl From<...> for Error { fn from(err: ...) -> Self { ... } } functions as `#[inline]` There was a recent request [1] to inline the simple from() Error functions to avoid the function call overhead. This patch inlines all of the functions. 1: https://lkml.org/lkml/2026/3/13/962 Signed-off-by: Alistair Francis --- 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 }