@@ -189,7 +189,7 @@ fn context_property(node: Pairs<Rule>) -> ContextResolver {
189189 . properties
190190 . as_ref ( ) ?
191191 . get ( context_name. as_str ( ) )
192- . map ( |v| Cow :: Borrowed ( v . as_str ( ) ) )
192+ . map ( Cow :: Borrowed )
193193 } )
194194}
195195
@@ -530,7 +530,6 @@ fn external_value(node: Pairs<Rule>) -> CompileResult<RuleFragment> {
530530 . external_results
531531 . as_ref ( )
532532 . and_then ( |strategy_results| strategy_results. get ( & strategy_index) )
533- . copied ( )
534533 . unwrap_or ( false )
535534 } ) )
536535}
@@ -661,6 +660,8 @@ pub fn compile_rule(rule: &str) -> CompileResult<RuleFragment> {
661660
662661#[ cfg( test) ]
663662mod tests {
663+ use crate :: state:: { ExternalResultsRef , PropertiesRef } ;
664+
664665 use super :: * ;
665666 use std:: collections:: HashMap ;
666667 use test_case:: test_case;
@@ -825,7 +826,7 @@ mod tests {
825826 let context = Context {
826827 current_time : None ,
827828 user_id : Some ( "6" . into ( ) ) ,
828- properties : Some ( & context_property) ,
829+ properties : Some ( PropertiesRef :: Strings ( & context_property) ) ,
829830 session_id : None ,
830831 environment : None ,
831832 app_name : None ,
@@ -872,7 +873,7 @@ mod tests {
872873 let context = Context {
873874 user_id : Some ( "42" . into ( ) ) ,
874875 session_id : Some ( "7" . into ( ) ) ,
875- properties : Some ( & props) ,
876+ properties : Some ( PropertiesRef :: Strings ( & props) ) ,
876877 ..Context :: default ( )
877878 } ;
878879
@@ -958,7 +959,7 @@ mod tests {
958959 let mut context = Context :: default ( ) ;
959960 let mut props = HashMap :: new ( ) ;
960961 props. insert ( "cutoff" . into ( ) , "2022-01-25T13:00:00.000Z" . into ( ) ) ;
961- context. properties = Some ( & props) ;
962+ context. properties = Some ( PropertiesRef :: Strings ( & props) ) ;
962963
963964 assert_eq ! ( rule( & context) , expected) ;
964965 }
@@ -971,7 +972,7 @@ mod tests {
971972 let mut context = Context :: default ( ) ;
972973 let mut props = HashMap :: new ( ) ;
973974 props. insert ( "cutoff" . into ( ) , "2022-01-25T13:00:00.000Z" . into ( ) ) ;
974- context. properties = Some ( & props) ;
975+ context. properties = Some ( PropertiesRef :: Strings ( & props) ) ;
975976
976977 assert ! ( !rule( & context) ) ;
977978 }
@@ -1052,7 +1053,7 @@ mod tests {
10521053 custom_strategy_results. insert ( "test_value" . to_string ( ) , true ) ;
10531054
10541055 let context = Context {
1055- external_results : Some ( & custom_strategy_results) ,
1056+ external_results : Some ( ExternalResultsRef :: Strings ( & custom_strategy_results) ) ,
10561057 ..Context :: default ( )
10571058 } ;
10581059
@@ -1068,7 +1069,7 @@ mod tests {
10681069 custom_strategy_results. insert ( "test_value" . to_string ( ) , true ) ;
10691070
10701071 let context = Context {
1071- external_results : Some ( & custom_strategy_results) ,
1072+ external_results : Some ( ExternalResultsRef :: Strings ( & custom_strategy_results) ) ,
10721073 ..Context :: default ( )
10731074 } ;
10741075
@@ -1077,7 +1078,7 @@ mod tests {
10771078 let mut custom_strategy_results = HashMap :: new ( ) ;
10781079 custom_strategy_results. insert ( "test_value" . to_string ( ) , false ) ;
10791080 let context = Context {
1080- external_results : Some ( & custom_strategy_results) ,
1081+ external_results : Some ( ExternalResultsRef :: Strings ( & custom_strategy_results) ) ,
10811082 ..Context :: default ( )
10821083 } ;
10831084
0 commit comments