pub fn flatten_result(res: Result, E>) -> Result { match res { Ok(Ok(t)) => Ok(t), Ok(Err(e)) => Err(e), Err(e) => Err(e), } }