mirror of
https://github.com/eyre-rs/eyre.git
synced 2025-09-30 06:21:52 +00:00
Remove &E argument from with_context signature
This commit is contained in:
parent
895d3834e5
commit
dc003568d7
@ -15,7 +15,7 @@ pub trait Context<T, E> {
|
|||||||
fn with_context<C, F>(self, f: F) -> Result<T, Error>
|
fn with_context<C, F>(self, f: F) -> Result<T, Error>
|
||||||
where
|
where
|
||||||
C: Display + Send + Sync + 'static,
|
C: Display + Send + Sync + 'static,
|
||||||
F: FnOnce(&E) -> C;
|
F: FnOnce() -> C;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T, E> Context<T, E> for Result<T, E>
|
impl<T, E> Context<T, E> for Result<T, E>
|
||||||
@ -32,11 +32,11 @@ where
|
|||||||
fn with_context<C, F>(self, f: F) -> Result<T, Error>
|
fn with_context<C, F>(self, f: F) -> Result<T, Error>
|
||||||
where
|
where
|
||||||
C: Display + Send + Sync + 'static,
|
C: Display + Send + Sync + 'static,
|
||||||
F: FnOnce(&E) -> C,
|
F: FnOnce() -> C,
|
||||||
{
|
{
|
||||||
self.map_err(|error| {
|
self.map_err(|error| {
|
||||||
Error::from(ContextError {
|
Error::from(ContextError {
|
||||||
context: f(&error),
|
context: f(),
|
||||||
error,
|
error,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -54,11 +54,11 @@ impl<T> Context<T, Error> for Result<T, Error> {
|
|||||||
fn with_context<C, F>(self, f: F) -> Result<T, Error>
|
fn with_context<C, F>(self, f: F) -> Result<T, Error>
|
||||||
where
|
where
|
||||||
C: Display + Send + Sync + 'static,
|
C: Display + Send + Sync + 'static,
|
||||||
F: FnOnce(&Error) -> C,
|
F: FnOnce() -> C,
|
||||||
{
|
{
|
||||||
self.map_err(|error| {
|
self.map_err(|error| {
|
||||||
Error::from(ContextError {
|
Error::from(ContextError {
|
||||||
context: f(&error),
|
context: f(),
|
||||||
error,
|
error,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user