7 lines
160 B
Rust
7 lines
160 B
Rust
pub fn flatten_result<T, E>(res: Result<Result<T, E>, E>) -> Result<T, E> {
|
|
match res {
|
|
Ok(Ok(t)) => Ok(t),
|
|
Ok(Err(e)) => Err(e),
|
|
Err(e) => Err(e),
|
|
}
|
|
}
|