diff options
Diffstat (limited to 'vendor/anyhow/src')
-rw-r--r-- | vendor/anyhow/src/context.rs | 12 | ||||
-rw-r--r-- | vendor/anyhow/src/lib.rs | 2 |
2 files changed, 11 insertions, 3 deletions
diff --git a/vendor/anyhow/src/context.rs b/vendor/anyhow/src/context.rs index 1b7dd31ac..238473e5c 100644 --- a/vendor/anyhow/src/context.rs +++ b/vendor/anyhow/src/context.rs @@ -47,7 +47,12 @@ where where C: Display + Send + Sync + 'static, { - self.map_err(|error| error.ext_context(context)) + // Not using map_err to save 2 useless frames off the captured backtrace + // in ext_context. + match self { + Ok(ok) => Ok(ok), + Err(error) => Err(error.ext_context(context)), + } } fn with_context<C, F>(self, context: F) -> Result<T, Error> @@ -55,7 +60,10 @@ where C: Display + Send + Sync + 'static, F: FnOnce() -> C, { - self.map_err(|error| error.ext_context(context())) + match self { + Ok(ok) => Ok(ok), + Err(error) => Err(error.ext_context(context())), + } } } diff --git a/vendor/anyhow/src/lib.rs b/vendor/anyhow/src/lib.rs index 792a4d007..583ab424e 100644 --- a/vendor/anyhow/src/lib.rs +++ b/vendor/anyhow/src/lib.rs @@ -210,7 +210,7 @@ //! will require an explicit `.map_err(Error::msg)` when working with a //! non-Anyhow error type inside a function that returns Anyhow's error type. -#![doc(html_root_url = "https://docs.rs/anyhow/1.0.65")] +#![doc(html_root_url = "https://docs.rs/anyhow/1.0.66")] #![cfg_attr(backtrace, feature(error_generic_member_access, provide_any))] #![cfg_attr(doc_cfg, feature(doc_cfg))] #![cfg_attr(not(feature = "std"), no_std)] |