Updated dependencies to use u2f crate directly, and some style changes

This commit is contained in:
Daniel García
2019-01-04 00:25:38 +01:00
parent c8af62ed48
commit 5f49ecd7f3
7 changed files with 110 additions and 114 deletions

View File

@@ -76,17 +76,17 @@ impl Error {
}
}
pub trait MapResult<S, E> {
fn map_res(self, msg: &str) -> Result<S, E>;
pub trait MapResult<S> {
fn map_res(self, msg: &str) -> Result<S, Error>;
}
impl<S, E: Into<Error>> MapResult<S, Error> for Result<S, E> {
impl<S, E: Into<Error>> MapResult<S> for Result<S, E> {
fn map_res(self, msg: &str) -> Result<S, Error> {
self.map_err(|e| e.into().with_msg(msg))
}
}
impl<E: Into<Error>> MapResult<(), Error> for Result<usize, E> {
impl<E: Into<Error>> MapResult<()> for Result<usize, E> {
fn map_res(self, msg: &str) -> Result<(), Error> {
self.and(Ok(())).map_res(msg)
}