@@ -121,10 +121,6 @@ pub struct Parts {
121121#[ derive( Debug ) ]
122122pub struct InvalidUri ( ErrorKind ) ;
123123
124- /// An error resulting from a failed attempt to construct a URI.
125- #[ derive( Debug ) ]
126- pub struct InvalidUriBytes ( InvalidUri ) ;
127-
128124/// An error resulting from a failed attempt to construct a URI.
129125#[ derive( Debug ) ]
130126pub struct InvalidUriParts ( InvalidUri ) ;
@@ -260,7 +256,7 @@ impl Uri {
260256 /// assert_eq!(uri.path(), "/foo");
261257 /// # }
262258 /// ```
263- fn from_shared ( s : Bytes ) -> Result < Uri , InvalidUriBytes > {
259+ fn from_shared ( s : Bytes ) -> Result < Uri , InvalidUri > {
264260 use self :: ErrorKind :: * ;
265261
266262 if s. len ( ) > MAX_LEN {
@@ -697,7 +693,7 @@ impl<'a> TryFrom<&'a String> for Uri {
697693}
698694
699695impl TryFrom < String > for Uri {
700- type Error = InvalidUriBytes ;
696+ type Error = InvalidUri ;
701697
702698 #[ inline]
703699 fn try_from ( t : String ) -> Result < Self , Self :: Error > {
@@ -785,9 +781,9 @@ impl From<Uri> for Parts {
785781 }
786782}
787783
788- fn parse_full ( mut s : Bytes ) -> Result < Uri , InvalidUriBytes > {
784+ fn parse_full ( mut s : Bytes ) -> Result < Uri , InvalidUri > {
789785 // Parse the scheme
790- let scheme = match Scheme2 :: parse ( & s[ ..] ) . map_err ( InvalidUriBytes ) ? {
786+ let scheme = match Scheme2 :: parse ( & s[ ..] ) ? {
791787 Scheme2 :: None => Scheme2 :: None ,
792788 Scheme2 :: Standard ( p) => {
793789 // TODO: use truncate
@@ -810,7 +806,7 @@ fn parse_full(mut s: Bytes) -> Result<Uri, InvalidUriBytes> {
810806
811807 // Find the end of the authority. The scheme will already have been
812808 // extracted.
813- let authority_end = Authority :: parse ( & s[ ..] ) . map_err ( InvalidUriBytes ) ?;
809+ let authority_end = Authority :: parse ( & s[ ..] ) ?;
814810
815811 if scheme. is_none ( ) {
816812 if authority_end != s. len ( ) {
@@ -850,7 +846,7 @@ impl FromStr for Uri {
850846
851847 #[ inline]
852848 fn from_str ( s : & str ) -> Result < Uri , InvalidUri > {
853- Uri :: from_shared ( Bytes :: copy_from_slice ( s. as_bytes ( ) ) ) . map_err ( |e| e . 0 )
849+ Uri :: from_shared ( Bytes :: copy_from_slice ( s. as_bytes ( ) ) )
854850 }
855851}
856852
@@ -1019,12 +1015,6 @@ impl From<ErrorKind> for InvalidUri {
10191015 }
10201016}
10211017
1022- impl From < ErrorKind > for InvalidUriBytes {
1023- fn from ( src : ErrorKind ) -> InvalidUriBytes {
1024- InvalidUriBytes ( src. into ( ) )
1025- }
1026- }
1027-
10281018impl From < ErrorKind > for InvalidUriParts {
10291019 fn from ( src : ErrorKind ) -> InvalidUriParts {
10301020 InvalidUriParts ( src. into ( ) )
@@ -1055,24 +1045,12 @@ impl Error for InvalidUri {
10551045 }
10561046}
10571047
1058- impl fmt:: Display for InvalidUriBytes {
1059- fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
1060- self . 0 . fmt ( f)
1061- }
1062- }
1063-
10641048impl fmt:: Display for InvalidUriParts {
10651049 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
10661050 self . 0 . fmt ( f)
10671051 }
10681052}
10691053
1070- impl Error for InvalidUriBytes {
1071- fn description ( & self ) -> & str {
1072- self . 0 . description ( )
1073- }
1074- }
1075-
10761054impl Error for InvalidUriParts {
10771055 fn description ( & self ) -> & str {
10781056 self . 0 . description ( )
0 commit comments