|
1 | 1 | use super::{Error, Result};
|
2 |
| -use core::{ |
3 |
| - convert::Infallible, |
4 |
| - ops::{ControlFlow, FromResidual, Try}, |
5 |
| -}; |
6 |
| -use core::{fmt::Debug, num::NonZeroUsize}; |
| 2 | +use core::fmt::Debug; |
7 | 3 |
|
8 | 4 | /// Bit indicating that an UEFI status code is an error
|
9 | 5 | const ERROR_BIT: usize = 1 << (core::mem::size_of::<usize>() * 8 - 1);
|
@@ -172,45 +168,6 @@ impl From<Status> for Result<(), ()> {
|
172 | 168 | }
|
173 | 169 | }
|
174 | 170 |
|
175 |
| -pub struct StatusResidual(NonZeroUsize); |
176 |
| - |
177 |
| -impl Try for Status { |
178 |
| - type Output = (); |
179 |
| - type Residual = StatusResidual; |
180 |
| - |
181 |
| - fn branch(self) -> ControlFlow<Self::Residual, Self::Output> { |
182 |
| - match NonZeroUsize::new(self.0) { |
183 |
| - Some(r) => ControlFlow::Break(StatusResidual(r)), |
184 |
| - None => ControlFlow::Continue(()), |
185 |
| - } |
186 |
| - } |
187 |
| - |
188 |
| - fn from_output(_output: Self::Output) -> Self { |
189 |
| - Self::SUCCESS |
190 |
| - } |
191 |
| -} |
192 |
| - |
193 |
| -impl FromResidual for Status { |
194 |
| - fn from_residual(r: StatusResidual) -> Self { |
195 |
| - Status(r.0.into()) |
196 |
| - } |
197 |
| -} |
198 |
| - |
199 |
| -impl<T> FromResidual<StatusResidual> for Result<T, ()> { |
200 |
| - fn from_residual(r: StatusResidual) -> Self { |
201 |
| - Err(Status(r.0.into()).into()) |
202 |
| - } |
203 |
| -} |
204 |
| - |
205 |
| -impl FromResidual<core::result::Result<Infallible, Error>> for Status { |
206 |
| - fn from_residual(r: core::result::Result<Infallible, Error>) -> Self { |
207 |
| - match r { |
208 |
| - Err(err) => err.status(), |
209 |
| - Ok(infallible) => match infallible {}, |
210 |
| - } |
211 |
| - } |
212 |
| -} |
213 |
| - |
214 | 171 | #[cfg(test)]
|
215 | 172 | mod tests {
|
216 | 173 | use super::*;
|
|
0 commit comments