1
- #![ deny( missing_docs) ]
1
+ // #![deny(missing_docs)]
2
2
#![ allow( unknown_lints) ] // to be removed when unused_doc_comments lints is merged
3
3
#![ doc( html_root_url = "https://docs.rs/error-chain/0.11.0-rc.2" ) ]
4
4
@@ -563,13 +563,16 @@ pub trait ChainedError<S: ?Sized>: error::Error + Send + 'static {
563
563
type ErrorKind ;
564
564
565
565
/// Constructs an error from a kind, and generates a backtrace.
566
- fn from_kind ( kind : Self :: ErrorKind ) -> Self where Self : Sized ;
566
+ fn from_kind ( kind : Self :: ErrorKind ) -> Self
567
+ where
568
+ Self : Sized ;
567
569
568
570
/// Constructs a chained error from another error and a kind, and generates a backtrace.
569
571
fn with_chain < E , K > ( error : E , kind : K ) -> Self
570
- where Self : Sized ,
571
- E : ToError + :: std:: error:: Error + Send + ' static ,
572
- K : Into < Self :: ErrorKind > ;
572
+ where
573
+ Self : Sized ,
574
+ E : ToError + :: std:: error:: Error + Send + ' static ,
575
+ K : Into < Self :: ErrorKind > ;
573
576
574
577
/// Returns the kind of the error.
575
578
fn kind ( & self ) -> & Self :: ErrorKind ;
@@ -584,18 +587,21 @@ pub trait ChainedError<S: ?Sized>: error::Error + Send + 'static {
584
587
/// context of this error.
585
588
///
586
589
/// The full cause chain and backtrace, if present, will be printed.
587
- fn display_chain < ' a > ( & ' a self ) -> DisplayChain < ' a , Self > {
590
+ fn display_chain < ' a > ( & ' a self ) -> DisplayChain < ' a , Self , S > {
588
591
DisplayChain ( self , PhantomData )
589
592
}
590
593
591
594
/// Extends the error chain with a new entry.
592
595
fn chain_err < F , EK > ( self , error : F ) -> Self
593
- where F : FnOnce ( ) -> EK ,
594
- EK : Into < Self :: ErrorKind > ;
596
+ where
597
+ F : FnOnce ( ) -> EK ,
598
+ EK : Into < Self :: ErrorKind > ;
595
599
596
600
/// Creates an error from its parts.
597
601
#[ doc( hidden) ]
598
- fn new ( kind : Self :: ErrorKind , state : State < S > ) -> Self where Self : Sized ;
602
+ fn new ( kind : Self :: ErrorKind , state : State < S > ) -> Self
603
+ where
604
+ Self : Sized ;
599
605
600
606
/// Returns the first known backtrace, either from its State or from one
601
607
/// of the errors from `foreign_links`.
@@ -608,19 +614,19 @@ pub trait ToError {
608
614
fn to_error ( & self ) -> & ( error:: Error + Send + ' static ) ;
609
615
}
610
616
617
+ impl < T : ?Sized + ToError + error:: Error + Send + ' static > ToError for Box < T > {
618
+ fn to_error ( & self ) -> & ( error:: Error + Send + ' static ) {
619
+ self
620
+ }
621
+ }
622
+
611
623
/// A struct which formats an error for output.
612
624
#[ derive( Debug ) ]
613
- <<<<<<< HEAD
614
- pub struct DisplayChain < ' a , T : ' a + ?Sized > ( & ' a T ) ;
615
-
616
- impl <' a , T > fmt:: Display for DisplayChain < ' a , T >
617
- where T : ChainedError
618
- =======
619
- pub struct Display < ' a , T : ' a + ?Sized , S : ?Sized > ( & ' a T , PhantomData < S > ) ;
625
+ pub struct DisplayChain < ' a , T : ' a + ?Sized , S : ?Sized > ( & ' a T , PhantomData < S > ) ;
620
626
621
- impl <' a , T , S > fmt:: Display for Display < ' a , T , S >
622
- where T : ChainedError < S >
623
- >>>>>>> Add generic parameter to some types ( errors can now add trait bounds )
627
+ impl < ' a , T , S > fmt:: Display for DisplayChain < ' a , T , S >
628
+ where
629
+ T : ChainedError < S > ,
624
630
{
625
631
fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
626
632
// Keep `try!` for 1.10 support
@@ -665,7 +671,8 @@ impl<T: ?Sized> Default for State<T> {
665
671
}
666
672
667
673
impl < T > State < T >
668
- where T : ToError + ?Sized
674
+ where
675
+ T : ToError + ?Sized ,
669
676
{
670
677
/// Creates a new State type
671
678
#[ cfg( feature = "backtrace" ) ]
0 commit comments