@@ -12,7 +12,6 @@ use num_traits::cast::FromPrimitive;
1212use num_traits:: ToPrimitive ;
1313use serde_json:: { Number , Value } ;
1414use std:: str:: FromStr ;
15- use tracing:: error;
1615
1716pub trait TypeCheckIn {
1817 fn validate_function_parameters (
@@ -968,7 +967,7 @@ fn get_record(
968967 value_errors
969968 . iter ( )
970969 . map ( |err| format ! ( "Invalid value for the key {}. Error: {}" , name, err) )
971- . collect ( ) ,
970+ . collect :: < Vec < _ > > ( ) ,
972971 ) ,
973972 }
974973 } else {
@@ -1965,22 +1964,25 @@ mod tests {
19651964 "key2" : "value2" ,
19661965 } ) ;
19671966
1967+ let key1 = "key1" . to_string ( ) ;
1968+ let key2 = "key2" . to_string ( ) ;
1969+
19681970 let name_type_pairs: Vec < ( & String , & Type ) > = vec ! [
19691971 (
1970- & " key1" . to_string ( ) ,
1972+ & key1,
19711973 & Type :: Primitive ( TypePrimitive {
19721974 primitive: PrimitiveType :: Str as i32 ,
19731975 } ) ,
19741976 ) ,
19751977 (
1976- & " key2" . to_string ( ) ,
1978+ & key2,
19771979 & Type :: Primitive ( TypePrimitive {
19781980 primitive: PrimitiveType :: Str as i32 ,
19791981 } ) ,
19801982 ) ,
19811983 ] ;
19821984
1983- let result = get_record ( & input_json, name_type_pairs) ;
1985+ let result = get_record ( & input_json, name_type_pairs. clone ( ) ) ;
19841986 let expected_result = Ok ( ValRecord {
19851987 values : vec ! [
19861988 VVal {
@@ -1998,7 +2000,7 @@ mod tests {
19982000 "key1" : "value1" ,
19992001 } ) ;
20002002
2001- let result = get_record ( & input_json, name_type_pairs) ;
2003+ let result = get_record ( & input_json, name_type_pairs. clone ( ) ) ;
20022004 assert_eq ! ( result. is_err( ) , true ) ;
20032005 }
20042006}
0 commit comments