diff options
Diffstat (limited to 'src/error.rs')
-rw-r--r-- | src/error.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/error.rs b/src/error.rs index 032e2c2..517b5fc 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,4 +1,7 @@ -pub fn helper<T, V>(res: Result<T, V>) -> T +// This Result is used elsewhere, not in helper() +pub type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>; + +pub fn helper<T, V>(res: std::result::Result<T, V>) -> T where V: std::fmt::Debug, { @@ -17,7 +20,7 @@ mod tests { #[test] fn shouldnt_panic() { - let ok: Result<&str, &str> = Ok("okay"); + let ok: std::result::Result<&str, &str> = Ok("okay"); let rhs = helper(ok); assert_eq!("okay", rhs); } @@ -25,7 +28,7 @@ mod tests { #[test] #[should_panic] fn should_panic() { - let err: Result<&str, &str> = Err("oops"); + let err: std::result::Result<&str, &str> = Err("oops"); helper(err); } } |