Skip to content

Commit 854d7b1

Browse files
committed
rust: error: move From<AllocError> for Error impl
This is part of the effort to minimize the differences of the `rust` branch with respect to mainline in order to eventually drop it. Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 0659796 commit 854d7b1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

rust/kernel/error.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,12 @@ impl fmt::Debug for Error {
257257
}
258258
}
259259

260+
impl From<AllocError> for Error {
261+
fn from(_: AllocError) -> Error {
262+
code::ENOMEM
263+
}
264+
}
265+
260266
impl From<TryFromIntError> for Error {
261267
fn from(_: TryFromIntError) -> Error {
262268
code::EINVAL
@@ -315,12 +321,6 @@ impl From<core::convert::Infallible> for Error {
315321
/// just an [`Error`].
316322
pub type Result<T = ()> = core::result::Result<T, Error>;
317323

318-
impl From<AllocError> for Error {
319-
fn from(_: AllocError) -> Error {
320-
code::ENOMEM
321-
}
322-
}
323-
324324
// # Invariant: `-bindings::MAX_ERRNO` fits in an `i16`.
325325
crate::static_assert!(bindings::MAX_ERRNO <= -(i16::MIN as i32) as u32);
326326

0 commit comments

Comments
 (0)