@@ -659,10 +659,11 @@ mod tests {
659659
660660 #[ derive( Debug , Deserialize ) ]
661661 #[ serde( untagged) ]
662+ #[ serde( bound( deserialize = "'de: 'a" ) ) ]
662663 #[ allow( clippy:: large_enum_variant) ]
663- enum ExpectedMatch {
664+ enum ExpectedMatch < ' a > {
664665 String ( String ) ,
665- MatchResult ( MatchResult ) ,
666+ MatchResult ( MatchResult < ' a > ) ,
666667 }
667668
668669 #[ derive( Debug , Deserialize ) ]
@@ -674,28 +675,30 @@ mod tests {
674675 #[ allow( clippy:: large_enum_variant) ]
675676 #[ derive( Debug , Clone , PartialEq , Eq , Serialize , Deserialize ) ]
676677 #[ serde( untagged) ]
677- pub enum StringOrInitOrOptions {
678+ pub enum StringOrInitOrOptions < ' a > {
678679 Options ( UrlPatternOptions ) ,
679- StringOrInit ( quirks:: StringOrInit ) ,
680+ StringOrInit ( quirks:: StringOrInit < ' a > ) ,
680681 }
681682
682683 #[ derive( Debug , Deserialize ) ]
683- struct TestCase {
684+ #[ serde( bound( deserialize = "'de: 'a" ) ) ]
685+ struct TestCase < ' a > {
684686 skip : Option < String > ,
685- pattern : Vec < StringOrInitOrOptions > ,
687+ pattern : Vec < StringOrInitOrOptions < ' a > > ,
686688 #[ serde( default ) ]
687- inputs : Vec < quirks:: StringOrInit > ,
688- expected_obj : Option < quirks:: StringOrInit > ,
689- expected_match : Option < ExpectedMatch > ,
689+ inputs : Vec < quirks:: StringOrInit < ' a > > ,
690+ expected_obj : Option < quirks:: StringOrInit < ' a > > ,
691+ expected_match : Option < ExpectedMatch < ' a > > ,
690692 #[ serde( default ) ]
691693 exactly_empty_components : Vec < String > ,
692694 }
693695
694696 #[ derive( Debug , Deserialize ) ]
695- struct MatchResult {
697+ #[ serde( bound( deserialize = "'de: 'a" ) ) ]
698+ struct MatchResult < ' a > {
696699 #[ serde( deserialize_with = "deserialize_match_result_inputs" ) ]
697700 #[ serde( default ) ]
698- inputs : Option < ( quirks:: StringOrInit , Option < String > ) > ,
701+ inputs : Option < ( quirks:: StringOrInit < ' a > , Option < String > ) > ,
699702
700703 protocol : Option < ComponentResult > ,
701704 username : Option < ComponentResult > ,
@@ -707,17 +710,17 @@ mod tests {
707710 hash : Option < ComponentResult > ,
708711 }
709712
710- fn deserialize_match_result_inputs < ' de , D > (
713+ fn deserialize_match_result_inputs < ' a , D > (
711714 deserializer : D ,
712- ) -> Result < Option < ( quirks:: StringOrInit , Option < String > ) > , D :: Error >
715+ ) -> Result < Option < ( quirks:: StringOrInit < ' a > , Option < String > ) > , D :: Error >
713716 where
714- D : serde:: Deserializer < ' de > ,
717+ D : serde:: Deserializer < ' a > ,
715718 {
716719 #[ derive( Debug , Deserialize ) ]
717720 #[ serde( untagged) ]
718- enum MatchResultInputs {
719- OneArgument ( ( quirks:: StringOrInit , ) ) ,
720- TwoArguments ( quirks:: StringOrInit , String ) ,
721+ enum MatchResultInputs < ' a > {
722+ OneArgument ( ( quirks:: StringOrInit < ' a > , ) ) ,
723+ TwoArguments ( quirks:: StringOrInit < ' a > , String ) ,
721724 }
722725
723726 let res = Option :: < MatchResultInputs > :: deserialize ( deserializer) ?;
@@ -811,7 +814,7 @@ mod tests {
811814 ..
812815 } ) = & input
813816 {
814- base_url = Some ( url. clone ( ) )
817+ base_url = Some ( url. clone ( ) . into ( ) )
815818 }
816819
817820 macro_rules! assert_field {
@@ -921,7 +924,8 @@ mod tests {
921924
922925 let input = input. unwrap_or_else ( || StringOrInit :: Init ( Default :: default ( ) ) ) ;
923926
924- let expected_input = ( input. clone ( ) , base_url. clone ( ) ) ;
927+ let expected_input =
928+ ( input. clone ( ) , base_url. clone ( ) . map ( |s| s. to_string ( ) ) ) ;
925929
926930 let match_input = quirks:: process_match_input ( input, base_url. as_deref ( ) ) ;
927931
@@ -1058,7 +1062,7 @@ mod tests {
10581062 #[ test]
10591063 fn issue46 ( ) {
10601064 quirks:: process_construct_pattern_input (
1061- quirks:: StringOrInit :: String ( ":café://:foo" . to_owned ( ) ) ,
1065+ quirks:: StringOrInit :: String ( ":café://:foo" . to_owned ( ) . into ( ) ) ,
10621066 None ,
10631067 )
10641068 . unwrap ( ) ;
0 commit comments