Skip to content
Myr

Change Error::from calls to Error::new to cut one level of noise from backtraces

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Tolnay · committed by David Tolnay · parent 4a350f9 · Browse files · 2 files+4 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+4 added−4 removed

  • other:+4 added−4 removed

2 files+4 added−4 removed

modified:src/context.rs+2 added-2 removed
67 unmodified lines
68 fn context<C>(self, context: C) -> Result<T, Error>69 where70 C: Display + Send + Sync + 'static,71 {72 self.map_err(|error| Error::from(ContextError { error, context }))72 self.map_err(|error| Error::new(ContextError { error, context }))73 }7475 fn with_context<C, F>(self, context: F) -> Result<T, Error>76 where77 C: Display + Send + Sync + 'static,78 F: FnOnce() -> C,79 {80 self.map_err(|error| {81 Error::from(ContextError {81 Error::new(ContextError {82 error,83 context: context(),84 })85 })
72 unmodified lines
modified:src/error.rs+2 added-2 removed
132 unmodified lines
133 pub fn context<C>(self, context: C) -> Self134 where135 C: Display + Send + Sync + 'static,136 {137 Error::from(ContextError {137 Error::new(ContextError {138 error: self,139 context,140 })141 }
362 unmodified lines
504 }505506 let has_dropped = Arc::new(AtomicBool::new(false));507508 drop(Error::from(DetectDrop {508 drop(Error::new(DetectDrop {509 has_dropped: has_dropped.clone(),510 }));511512 assert!(has_dropped.load(SeqCst));
2 unmodified lines