Skip to content
Myr

Swap ContextError type parameters to match type name

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 def64cb · Browse files · 2 files+10 added−10 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+10 added−10 removed

  • other:+10 added−10 removed

2 files+10 added−10 removed

modified:src/context.rs+9 added-9 removed
22 unmodified lines
23 where24 C: Display + Send + Sync + 'static,25 {26 Error::new(ContextError {27 error: self,27 context,28 error: self,29 })30 }31 }32
63 unmodified lines
96 self.ok_or_else(|| Error::from_display(context(), backtrace!()))97 }98}99100pub(crate) struct ContextError<E, C> {101 pub error: E,100pub(crate) struct ContextError<C, E> {101 pub context: C,102 pub error: E,103}104105impl<E, C> Debug for ContextError<E, C>105impl<C, E> Debug for ContextError<C, E>106where107 E: Debug,107 C: Display,108 E: Debug,109{110 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {111 write!(f, "{:?}\n\n{}", self.error, self.context)112 }113}114115impl<E, C> Display for ContextError<E, C>115impl<C, E> Display for ContextError<C, E>116where117 C: Display,118{119 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {120 Display::fmt(&self.context, f)121 }122}123124impl<E, C> StdError for ContextError<E, C>124impl<C, E> StdError for ContextError<C, E>125where126 E: StdError + 'static,126 C: Display,127 E: StdError + 'static,128{129 #[cfg(backtrace)]130 fn backtrace(&self) -> Option<&Backtrace> {131 self.error.backtrace()
3 unmodified lines
135 Some(&self.error)136 }137}138139impl<C> StdError for ContextError<Error, C>139impl<C> StdError for ContextError<C, Error>140where141 C: Display,142{143 #[cfg(backtrace)]
17 unmodified lines
modified:src/error.rs+1 added-1 removed
142 unmodified lines
143 where144 C: Display + Send + Sync + 'static,145 {146 Error::new(ContextError {147 error: self,147 context,148 error: self,149 })150 }151152 /// Get the backtrace for this Error.
424 unmodified lines