540540//! [`BacktraceFrame`]: https://docs.rs/backtrace/0.3.2/backtrace/struct.BacktraceFrame.html
541541
542542use std:: error;
543- use std:: iter:: Iterator ;
544543use std:: fmt;
544+ use std:: iter:: Iterator ;
545545
546546#[ macro_use]
547547mod impl_error_chain_kind;
@@ -550,9 +550,9 @@ mod error_chain;
550550#[ macro_use]
551551mod quick_main;
552552pub use quick_main:: ExitCode ;
553+ mod backtrace;
553554#[ cfg( feature = "example_generated" ) ]
554555pub mod example_generated;
555- mod backtrace;
556556pub use backtrace:: Backtrace ;
557557#[ doc( hidden) ]
558558pub use backtrace:: InternalBacktrace ;
@@ -597,13 +597,16 @@ pub trait ChainedError: error::Error + Send + 'static {
597597 type ErrorKind ;
598598
599599 /// Constructs an error from a kind, and generates a backtrace.
600- fn from_kind ( kind : Self :: ErrorKind ) -> Self where Self : Sized ;
600+ fn from_kind ( kind : Self :: ErrorKind ) -> Self
601+ where
602+ Self : Sized ;
601603
602604 /// Constructs a chained error from another error and a kind, and generates a backtrace.
603605 fn with_chain < E , K > ( error : E , kind : K ) -> Self
604- where Self : Sized ,
605- E : :: std:: error:: Error + Send + ' static ,
606- K : Into < Self :: ErrorKind > ;
606+ where
607+ Self : Sized ,
608+ E : :: std:: error:: Error + Send + ' static ,
609+ K : Into < Self :: ErrorKind > ;
607610
608611 /// Returns the kind of the error.
609612 fn kind ( & self ) -> & Self :: ErrorKind ;
@@ -624,27 +627,32 @@ pub trait ChainedError: error::Error + Send + 'static {
624627
625628 /// Extends the error chain with a new entry.
626629 fn chain_err < F , EK > ( self , error : F ) -> Self
627- where F : FnOnce ( ) -> EK ,
628- EK : Into < Self :: ErrorKind > ;
630+ where
631+ F : FnOnce ( ) -> EK ,
632+ EK : Into < Self :: ErrorKind > ;
629633
630634 /// Creates an error from its parts.
631635 #[ doc( hidden) ]
632- fn new ( kind : Self :: ErrorKind , state : State ) -> Self where Self : Sized ;
636+ fn new ( kind : Self :: ErrorKind , state : State ) -> Self
637+ where
638+ Self : Sized ;
633639
634640 /// Returns the first known backtrace, either from its State or from one
635641 /// of the errors from `foreign_links`.
636642 #[ doc( hidden) ]
637643 #[ allow( unknown_lints, bare_trait_objects) ]
638644 fn extract_backtrace ( e : & ( error:: Error + Send + ' static ) ) -> Option < InternalBacktrace >
639- where Self : Sized ;
645+ where
646+ Self : Sized ;
640647}
641648
642649/// A struct which formats an error for output.
643650#[ derive( Debug ) ]
644651pub struct DisplayChain < ' a , T : ' a + ?Sized > ( & ' a T ) ;
645652
646653impl < ' a , T > fmt:: Display for DisplayChain < ' a , T >
647- where T : ChainedError
654+ where
655+ T : ChainedError ,
648656{
649657 fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
650658 writeln ! ( fmt, "Error: {}" , self . 0 ) ?;
@@ -685,8 +693,7 @@ impl State {
685693 /// Creates a new State type
686694 #[ allow( unknown_lints, bare_trait_objects) ]
687695 pub fn new < CE : ChainedError > ( e : Box < error:: Error + Send > ) -> State {
688- let backtrace = CE :: extract_backtrace ( & * e)
689- . unwrap_or_else ( InternalBacktrace :: new) ;
696+ let backtrace = CE :: extract_backtrace ( & * e) . unwrap_or_else ( InternalBacktrace :: new) ;
690697 State {
691698 next_error : Some ( e) ,
692699 backtrace : backtrace,
@@ -813,5 +820,5 @@ macro_rules! ensure {
813820
814821#[ doc( hidden) ]
815822pub mod mock {
816- error_chain ! { }
823+ error_chain ! { }
817824}
0 commit comments