Fix ambiguity in Result test
This commit is contained in:
parent
8c3bdcc35a
commit
7fe56e81b7
@ -220,13 +220,15 @@ fn test_try() {
|
|||||||
assert_eq!(try_result_none(), None);
|
assert_eq!(try_result_none(), None);
|
||||||
|
|
||||||
fn try_result_ok() -> Result<u8, u8> {
|
fn try_result_ok() -> Result<u8, u8> {
|
||||||
let val = Ok(1)?;
|
let result: Result<u8, u8> = Ok(1);
|
||||||
|
let val = result?;
|
||||||
Ok(val)
|
Ok(val)
|
||||||
}
|
}
|
||||||
assert_eq!(try_result_ok(), Ok(1));
|
assert_eq!(try_result_ok(), Ok(1));
|
||||||
|
|
||||||
fn try_result_err() -> Result<u8, u8> {
|
fn try_result_err() -> Result<u8, u8> {
|
||||||
let val = Err(1)?;
|
let result: Result<u8, u8> = Err(1);
|
||||||
|
let val = result?;
|
||||||
Ok(val)
|
Ok(val)
|
||||||
}
|
}
|
||||||
assert_eq!(try_result_err(), Err(1));
|
assert_eq!(try_result_err(), Err(1));
|
||||||
|
Loading…
Reference in New Issue
Block a user