mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-28 12:53:14 +01:00
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 <[email protected]>
Link: https://lore.kernel.org/all/[email protected]/ [1]
Signed-off-by: Alistair Francis <[email protected]>
Reviewed-by: Gary Guo <[email protected]>
[ Reworded commit message - Gary ]
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Gary Guo <[email protected]>
This commit is contained in:
1 parent
5d6919055d
commit
be7ea321a2
1 file changed
+2
@@ -11,6 +11,7 @@ use std::alloc::AllocError;
|
||||
pub struct Error;
|
||||
|
||||
impl From<Infallible> for Error {
|
||||
#[inline]
|
||||
fn from(e: Infallible) -> Self {
|
||||
match e {}
|
||||
}
|
||||
@@ -18,6 +19,7 @@ impl From<Infallible> for Error {
|
||||
|
||||
#[cfg(feature = "alloc")]
|
||||
impl From<AllocError> for Error {
|
||||
#[inline]
|
||||
fn from(_: AllocError) -> Self {
|
||||
Self
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user