We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f2123ab + 131249b commit 54fc812Copy full SHA for 54fc812
1 file changed
src/context.rs
@@ -47,15 +47,23 @@ where
47
where
48
C: Display + Send + Sync + 'static,
49
{
50
- self.map_err(|error| error.ext_context(context))
+ // Not using map_err to save 2 useless frames off the captured backtrace
51
+ // in ext_context.
52
+ match self {
53
+ Ok(ok) => Ok(ok),
54
+ Err(error) => Err(error.ext_context(context)),
55
+ }
56
}
57
58
fn with_context<C, F>(self, context: F) -> Result<T, Error>
59
60
61
F: FnOnce() -> C,
62
- self.map_err(|error| error.ext_context(context()))
63
64
65
+ Err(error) => Err(error.ext_context(context())),
66
67
68
69
0 commit comments