Skip to content

Commit 53883e1

Browse files
committed
Use more idiomatic Result<Infallible, Error> as Residual for ResultCode
1 parent 92ee28f commit 53883e1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ctru-rs/src/error.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub struct ResultCode(pub ctru_sys::Result);
4040

4141
impl Try for ResultCode {
4242
type Output = ();
43-
type Residual = Error;
43+
type Residual = std::result::Result<std::convert::Infallible, Error>;
4444

4545
fn from_output(_: Self::Output) -> Self {
4646
Self(0)
@@ -51,7 +51,7 @@ impl Try for ResultCode {
5151
// Luckily all summary cases are for system failures (except RS_SUCCESS).
5252
// I don't know if there are any cases in libctru where a Result holds a "failing" summary but a "success" code, so we'll just check for both.
5353
if ctru_sys::R_FAILED(self.0) || ctru_sys::R_SUMMARY(self.0) != ctru_sys::RS_SUCCESS {
54-
ControlFlow::Break(self.into())
54+
ControlFlow::Break(Err(self.into()))
5555
} else {
5656
ControlFlow::Continue(())
5757
}
@@ -61,7 +61,7 @@ impl Try for ResultCode {
6161
impl FromResidual for ResultCode {
6262
fn from_residual(e: <Self as Try>::Residual) -> Self {
6363
match e {
64-
Error::Os(result) => Self(result),
64+
Err(Error::Os(result)) => Self(result),
6565
_ => unreachable!(),
6666
}
6767
}

0 commit comments

Comments
 (0)