11#![ allow( missing_debug_implementations) ]
22
3- use crate :: {
4- component:: { Authority , IAuthority , Scheme } ,
5- convert:: ConvertError ,
6- parse:: { self , ParseError } ,
7- pct_enc:: { encoder:: * , EStr , Encoder } ,
8- } ;
9- use borrow_or_share:: { BorrowOrShare , Bos } ;
10- use core:: { borrow:: Borrow , cmp:: Ordering , fmt, hash, num:: NonZeroUsize , str} ;
11-
12- #[ cfg( feature = "alloc" ) ]
133use crate :: {
144 build:: {
155 state:: { NonRefStart , Start } ,
166 Builder ,
177 } ,
8+ component:: { Authority , IAuthority , Scheme } ,
9+ convert:: ConvertError ,
1810 normalize:: Normalizer ,
11+ parse:: { self , ParseError } ,
12+ pct_enc:: { encoder:: * , EStr , Encoder } ,
1913 resolve:: { self , ResolveError } ,
2014} ;
21- #[ cfg( feature = "alloc" ) ]
2215use alloc:: { borrow:: ToOwned , string:: String } ;
23- #[ cfg( feature = "alloc" ) ]
24- use core:: str:: FromStr ;
16+ use borrow_or_share:: { BorrowOrShare , Bos } ;
17+ use core:: {
18+ borrow:: Borrow ,
19+ cmp:: Ordering ,
20+ fmt, hash,
21+ num:: NonZeroUsize ,
22+ str:: { self , FromStr } ,
23+ } ;
2524
2625#[ cfg( feature = "net" ) ]
2726use crate :: net:: { Ipv4Addr , Ipv6Addr } ;
@@ -33,7 +32,6 @@ pub trait Value: Default {}
3332
3433impl Value for & str { }
3534
36- #[ cfg( feature = "alloc" ) ]
3735impl Value for String { }
3836
3937pub struct Constraints {
@@ -64,7 +62,6 @@ pub trait RiMaybeRef: Sized {
6462 Self :: Val : BorrowOrShare < ' i , ' o , str > ;
6563}
6664
67- #[ cfg( feature = "alloc" ) ]
6865pub trait Ri : RiMaybeRef {
6966 type Ref < T > : RiMaybeRef < Val = T > ;
7067}
@@ -85,7 +82,6 @@ impl<'a> Parse for &'a str {
8582 }
8683}
8784
88- #[ cfg( feature = "alloc" ) ]
8985impl Parse for String {
9086 type Val = Self ;
9187 type Err = ( ParseError , Self ) ;
@@ -296,7 +292,6 @@ macro_rules! ri_maybe_ref {
296292 }
297293
298294 $(
299- #[ cfg( feature = "alloc" ) ]
300295 impl <T : Bos <str >> Ri for $Ty<T > {
301296 type Ref <U > = $RefTy<U >;
302297 }
@@ -324,7 +319,6 @@ macro_rules! ri_maybe_ref {
324319 }
325320 }
326321
327- #[ cfg( feature = "alloc" ) ]
328322 impl $Ty<String > {
329323 #[ doc = concat!( "Creates a new builder for " , $name, "." ) ]
330324 #[ inline]
@@ -351,7 +345,6 @@ macro_rules! ri_maybe_ref {
351345 }
352346 }
353347
354- #[ cfg( feature = "alloc" ) ]
355348 impl $Ty<& str > {
356349 #[ doc = concat!( "Creates a new `" , $ty, "<String>` by cloning the contents of this `" , $ty, "<&str>`." ) ]
357350 #[ inline]
@@ -593,7 +586,6 @@ macro_rules! ri_maybe_ref {
593586 #[ doc = concat!( "assert_eq!(" , $var, ".resolve_against(&base).unwrap(), \" http://example.com/foo/bar?baz\" );" ) ]
594587 /// # Ok::<_, fluent_uri::ParseError>(())
595588 /// ```
596- #[ cfg( feature = "alloc" ) ]
597589 pub fn resolve_against<U : Bos <str >>(
598590 & self ,
599591 base: & $NonRefTy<U >,
@@ -639,7 +631,6 @@ macro_rules! ri_maybe_ref {
639631 #[ doc = concat!( "assert_eq!(" , $var, ".normalize(), \" example://a/b/c/%7Bfoo%7D\" );" ) ]
640632 /// # Ok::<_, fluent_uri::ParseError>(())
641633 /// ```
642- #[ cfg( feature = "alloc" ) ]
643634 #[ must_use]
644635 pub fn normalize( & self ) -> $Ty<String > {
645636 Normalizer :: new( ) . normalize( self ) . unwrap( )
@@ -749,15 +740,13 @@ macro_rules! ri_maybe_ref {
749740 #[ doc = concat!( "assert_eq!(" , $var, ".with_fragment(None), \" http://example.com/\" );" ) ]
750741 /// # Ok::<_, fluent_uri::ParseError>(())
751742 /// ```
752- #[ cfg( feature = "alloc" ) ]
753743 #[ must_use]
754744 pub fn with_fragment( & self , opt: Option <& EStr <$FragmentE>>) -> $Ty<String > {
755745 // Altering only the fragment does not change the metadata.
756746 RiMaybeRef :: new( self . make_ref( ) . with_fragment( opt. map( EStr :: as_str) ) , self . meta)
757747 }
758748 }
759749
760- #[ cfg( feature = "alloc" ) ]
761750 impl $Ty<String > {
762751 /// Replaces the fragment component of `self` with the given one.
763752 ///
@@ -865,7 +854,6 @@ macro_rules! ri_maybe_ref {
865854 }
866855 }
867856
868- #[ cfg( feature = "alloc" ) ]
869857 impl TryFrom <String > for $Ty<String > {
870858 type Error = ( ParseError , String ) ;
871859
@@ -884,7 +872,6 @@ macro_rules! ri_maybe_ref {
884872 }
885873 }
886874
887- #[ cfg( feature = "alloc" ) ]
888875 impl <' a> From <$Ty<String >> for String {
889876 #[ doc = concat!( "Equivalent to [`into_string`](" , $ty, "::into_string)." ) ]
890877 #[ inline]
@@ -893,7 +880,6 @@ macro_rules! ri_maybe_ref {
893880 }
894881 }
895882
896- #[ cfg( feature = "alloc" ) ]
897883 impl From <$Ty<& str >> for $Ty<String > {
898884 /// Equivalent to [`to_owned`](Self::to_owned).
899885 #[ inline]
@@ -902,7 +888,6 @@ macro_rules! ri_maybe_ref {
902888 }
903889 }
904890
905- #[ cfg( feature = "alloc" ) ]
906891 impl FromStr for $Ty<String > {
907892 type Err = ParseError ;
908893
@@ -1043,7 +1028,6 @@ impl<'v, 'm> RmrRef<'v, 'm> {
10431028 . map ( |i| self . eslice ( i, self . val . len ( ) ) )
10441029 }
10451030
1046- #[ cfg( feature = "alloc" ) ]
10471031 pub fn set_fragment ( buf : & mut String , meta : & Meta , opt : Option < & str > ) {
10481032 buf. truncate ( meta. query_or_path_end ( ) ) ;
10491033 if let Some ( s) = opt {
@@ -1057,7 +1041,6 @@ impl<'v, 'm> RmrRef<'v, 'm> {
10571041 & self . val [ ..self . meta . query_or_path_end ( ) ]
10581042 }
10591043
1060- #[ cfg( feature = "alloc" ) ]
10611044 pub fn with_fragment ( self , opt : Option < & str > ) -> String {
10621045 let stripped = self . strip_fragment ( ) ;
10631046 if let Some ( s) = opt {
0 commit comments