Skip to content

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

Open
alistair23 wants to merge 1 commit intoRust-for-Linux:mainfrom
alistair23:alistair/inline
Open

rust: kernel: mark as #[inline] all From::from()s for Error#126
alistair23 wants to merge 1 commit intoRust-for-Linux:mainfrom
alistair23:alistair/inline

Conversation

@alistair23
Copy link
Copy Markdown

@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

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]
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
@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
Author

Commit is updated

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