Skip to content

examples: mark as #[inline] all From::from()s for Error#126

Merged
nbdd0121 merged 1 commit intoRust-for-Linux:mainfrom
alistair23:alistair/inline
Apr 16, 2026
Merged

examples: mark as #[inline] all From::from()s for Error#126
nbdd0121 merged 1 commit intoRust-for-Linux:mainfrom
alistair23:alistair/inline

Conversation

@alistair23
Copy link
Copy Markdown
Contributor

@alistair23 alistair23 commented Mar 25, 2026

There was a recent request [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 in the kernel crate as #[inline].

Suggested-by: Gary Guo gary@garyguo.net
Link: https://lore.kernel.org/all/8403c8b7a832b5274743816eb77abfa4@garyguo.net/ [1]

Copy link
Copy Markdown
Member

@nbdd0121 nbdd0121 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think these #[inline]s are useful given it's only in examples, but I don't think these'll hurt either.

Anyhow, please adjust your commit summary and message to quote code blocks properly and to use lore link. You can see the commit message that Miguel fixed up for you: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4f13c93497e366cd8e41561a8e30ad4da887cb82

@alistair23 alistair23 changed the title rust: Mark all from() for Error functions inline rust: kernel: mark as #[inline] all From::from()s for Error Apr 16, 2026
@alistair23
Copy link
Copy Markdown
Contributor Author

Commit is updated

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 <gary@garyguo.net>
Link: https://lore.kernel.org/all/8403c8b7a832b5274743816eb77abfa4@garyguo.net/ [1]
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
[ Reworded commit message - Gary ]
Signed-off-by: Gary Guo <gary@garyguo.net>
@nbdd0121 nbdd0121 changed the title rust: kernel: mark as #[inline] all From::from()s for Error examples: mark as #[inline] all From::from()s for Error Apr 16, 2026
@nbdd0121 nbdd0121 merged commit f2f676b into Rust-for-Linux:main Apr 16, 2026
26 checks passed
@nbdd0121
Copy link
Copy Markdown
Member

Thanks

@alistair23 alistair23 deleted the alistair/inline branch April 16, 2026 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants