@@ -86,7 +86,7 @@ impl Field {
8686
8787 let vals_builder = match & self . ty {
8888 Type :: TypePath ( _) => self . copied_direct_vals ( ) ,
89- Type :: Option ( ref first_type) => match * * first_type {
89+ Type :: Option ( first_type) => match * * first_type {
9090 Type :: TypePath ( _) => self . option_into_vals ( ) ,
9191 Type :: Reference ( _, ref second_type) => match * * second_type {
9292 Type :: TypePath ( _) => self . option_into_vals ( ) ,
@@ -98,7 +98,7 @@ impl Field {
9898 } ,
9999 ref f => unimplemented ! ( "Unsupported: {:#?}" , f) ,
100100 } ,
101- Type :: Reference ( _, ref first_type) => match * * first_type {
101+ Type :: Reference ( _, first_type) => match * * first_type {
102102 Type :: TypePath ( _) => self . copied_direct_vals ( ) ,
103103 Type :: Option ( ref second_type) => match * * second_type {
104104 Type :: TypePath ( _) => self . option_into_vals ( ) ,
@@ -122,7 +122,7 @@ impl Field {
122122 } ,
123123 ref f => unimplemented ! ( "Unsupported: {:#?}" , f) ,
124124 } ,
125- Type :: Vec ( ref first_type) => match * * first_type {
125+ Type :: Vec ( first_type) => match * * first_type {
126126 Type :: TypePath ( _) => self . copied_direct_vals ( ) ,
127127 ref f => unimplemented ! ( "Unsupported: {:#?}" , f) ,
128128 } ,
@@ -131,7 +131,7 @@ impl Field {
131131
132132 let definition_levels = match & self . ty {
133133 Type :: TypePath ( _) => None ,
134- Type :: Option ( ref first_type) => match * * first_type {
134+ Type :: Option ( first_type) => match * * first_type {
135135 Type :: TypePath ( _) => Some ( self . optional_definition_levels ( ) ) ,
136136 Type :: Option ( _) => unimplemented ! ( "Unsupported nesting encountered" ) ,
137137 Type :: Reference ( _, ref second_type)
@@ -142,10 +142,10 @@ impl Field {
142142 _ => unimplemented ! ( "Unsupported nesting encountered" ) ,
143143 } ,
144144 } ,
145- Type :: Reference ( _, ref first_type)
146- | Type :: Vec ( ref first_type)
147- | Type :: Array ( ref first_type, _)
148- | Type :: Slice ( ref first_type) => match * * first_type {
145+ Type :: Reference ( _, first_type)
146+ | Type :: Vec ( first_type)
147+ | Type :: Array ( first_type, _)
148+ | Type :: Slice ( first_type) => match * * first_type {
149149 Type :: TypePath ( _) => None ,
150150 Type :: Vec ( ref second_type)
151151 | Type :: Array ( ref second_type, _)
@@ -192,15 +192,15 @@ impl Field {
192192 // this expression just switches between non-nullable and nullable write statements
193193 let write_batch_expr = if definition_levels. is_some ( ) {
194194 quote ! {
195- if let #column_writer( ref mut typed) = column_writer. untyped( ) {
195+ if let #column_writer( typed) = column_writer. untyped( ) {
196196 typed. write_batch( & vals[ ..] , Some ( & definition_levels[ ..] ) , None ) ?;
197197 } else {
198198 panic!( "Schema and struct disagree on type for {}" , stringify!{ #ident} )
199199 }
200200 }
201201 } else {
202202 quote ! {
203- if let #column_writer( ref mut typed) = column_writer. untyped( ) {
203+ if let #column_writer( typed) = column_writer. untyped( ) {
204204 typed. write_batch( & vals[ ..] , None , None ) ?;
205205 } else {
206206 panic!( "Schema and struct disagree on type for {}" , stringify!{ #ident} )
@@ -265,15 +265,15 @@ impl Field {
265265 // it to its field in the corresponding struct
266266 let vals_writer = match & self . ty {
267267 Type :: TypePath ( _) => self . copied_direct_fields ( ) ,
268- Type :: Reference ( _, ref first_type) => match * * first_type {
268+ Type :: Reference ( _, first_type) => match * * first_type {
269269 Type :: TypePath ( _) => self . copied_direct_fields ( ) ,
270270 Type :: Slice ( ref second_type) => match * * second_type {
271271 Type :: TypePath ( _) => self . copied_direct_fields ( ) ,
272272 ref f => unimplemented ! ( "Unsupported: {:#?}" , f) ,
273273 } ,
274274 ref f => unimplemented ! ( "Unsupported: {:#?}" , f) ,
275275 } ,
276- Type :: Vec ( ref first_type) => match * * first_type {
276+ Type :: Vec ( first_type) => match * * first_type {
277277 Type :: TypePath ( _) => self . copied_direct_fields ( ) ,
278278 ref f => unimplemented ! ( "Unsupported: {:#?}" , f) ,
279279 } ,
@@ -356,7 +356,7 @@ impl Field {
356356 let binding = if copy_to_vec {
357357 quote ! { let Some ( inner) = rec. #field_name }
358358 } else {
359- quote ! { let Some ( ref inner) = rec. #field_name }
359+ quote ! { let Some ( inner) = & rec. #field_name }
360360 } ;
361361
362362 let some = if is_a_timestamp {
@@ -545,11 +545,11 @@ impl Type {
545545 fn leaf_type_recursive_helper < ' a > ( ty : & ' a Type , parent_ty : Option < & ' a Type > ) -> & ' a Type {
546546 match ty {
547547 Type :: TypePath ( _) => parent_ty. unwrap_or ( ty) ,
548- Type :: Option ( ref first_type)
549- | Type :: Vec ( ref first_type)
550- | Type :: Array ( ref first_type, _)
551- | Type :: Slice ( ref first_type)
552- | Type :: Reference ( _, ref first_type) => {
548+ Type :: Option ( first_type)
549+ | Type :: Vec ( first_type)
550+ | Type :: Array ( first_type, _)
551+ | Type :: Slice ( first_type)
552+ | Type :: Reference ( _, first_type) => {
553553 Type :: leaf_type_recursive_helper ( first_type, Some ( ty) )
554554 }
555555 }
@@ -562,12 +562,12 @@ impl Type {
562562 let leaf_type = self . leaf_type_recursive ( ) ;
563563
564564 match leaf_type {
565- Type :: TypePath ( ref type_) => type_,
566- Type :: Option ( ref first_type)
567- | Type :: Vec ( ref first_type)
568- | Type :: Array ( ref first_type, _)
569- | Type :: Slice ( ref first_type)
570- | Type :: Reference ( _, ref first_type) => match * * first_type {
565+ Type :: TypePath ( type_) => type_,
566+ Type :: Option ( first_type)
567+ | Type :: Vec ( first_type)
568+ | Type :: Array ( first_type, _)
569+ | Type :: Slice ( first_type)
570+ | Type :: Reference ( _, first_type) => match * * first_type {
571571 Type :: TypePath ( ref type_) => type_,
572572 _ => unimplemented ! ( "leaf_type() should only return shallow types" ) ,
573573 } ,
@@ -612,14 +612,14 @@ impl Type {
612612 let leaf_type = self . leaf_type_recursive ( ) ;
613613
614614 match leaf_type {
615- Type :: Array ( ref first_type, _length) => {
615+ Type :: Array ( first_type, _length) => {
616616 if let Type :: TypePath ( _) = * * first_type {
617617 if last_part == "u8" {
618618 return BasicType :: FIXED_LEN_BYTE_ARRAY ;
619619 }
620620 }
621621 }
622- Type :: Vec ( ref first_type) | Type :: Slice ( ref first_type) => {
622+ Type :: Vec ( first_type) | Type :: Slice ( first_type) => {
623623 if let Type :: TypePath ( _) = * * first_type {
624624 if last_part == "u8" {
625625 return BasicType :: BYTE_ARRAY ;
@@ -654,7 +654,7 @@ impl Type {
654654 let leaf_type = self . leaf_type_recursive ( ) ;
655655
656656 // `[u8; N]` => Some(N)
657- if let Type :: Array ( ref first_type, length) = leaf_type {
657+ if let Type :: Array ( first_type, length) = leaf_type {
658658 if let Type :: TypePath ( _) = * * first_type {
659659 if last_part == "u8" {
660660 return Some ( length. clone ( ) ) ;
@@ -674,14 +674,14 @@ impl Type {
674674 let leaf_type = self . leaf_type_recursive ( ) ;
675675
676676 match leaf_type {
677- Type :: Array ( ref first_type, _length) => {
677+ Type :: Array ( first_type, _length) => {
678678 if let Type :: TypePath ( _) = * * first_type {
679679 if last_part == "u8" {
680680 return quote ! { None } ;
681681 }
682682 }
683683 }
684- Type :: Vec ( ref first_type) | Type :: Slice ( ref first_type) => {
684+ Type :: Vec ( first_type) | Type :: Slice ( first_type) => {
685685 if let Type :: TypePath ( _) = * * first_type {
686686 if last_part == "u8" {
687687 return quote ! { None } ;
@@ -764,10 +764,10 @@ impl Type {
764764
765765 fn from_type ( f : & syn:: Field , ty : & syn:: Type ) -> Self {
766766 match ty {
767- syn:: Type :: Path ( ref p) => Type :: from_type_path ( f, p) ,
768- syn:: Type :: Reference ( ref tr) => Type :: from_type_reference ( f, tr) ,
769- syn:: Type :: Array ( ref ta) => Type :: from_type_array ( f, ta) ,
770- syn:: Type :: Slice ( ref ts) => Type :: from_type_slice ( f, ts) ,
767+ syn:: Type :: Path ( p) => Type :: from_type_path ( f, p) ,
768+ syn:: Type :: Reference ( tr) => Type :: from_type_reference ( f, tr) ,
769+ syn:: Type :: Array ( ta) => Type :: from_type_array ( f, ta) ,
770+ syn:: Type :: Slice ( ts) => Type :: from_type_slice ( f, ts) ,
771771 other => unimplemented ! (
772772 "Unable to derive {:?} - it is currently an unsupported type\n {:#?}" ,
773773 f. ident. as_ref( ) . unwrap( ) ,
@@ -790,7 +790,7 @@ impl Type {
790790 let first_arg = & angle_args. args [ 0 ] ;
791791
792792 match first_arg {
793- syn:: GenericArgument :: Type ( ref typath) => typath. clone ( ) ,
793+ syn:: GenericArgument :: Type ( typath) => typath. clone ( ) ,
794794 other => unimplemented ! ( "Unsupported: {:#?}" , other) ,
795795 }
796796 }
@@ -857,7 +857,7 @@ mod test {
857857 {
858858 let vals : Vec < _ > = records . iter ( ) . map ( | rec | rec . counter as i64 ) . collect ( ) ;
859859
860- if let ColumnWriter :: Int64ColumnWriter ( ref mut typed ) = column_writer. untyped( ) {
860+ if let ColumnWriter :: Int64ColumnWriter ( typed ) = column_writer. untyped( ) {
861861 typed . write_batch ( & vals [ .. ] , None , None ) ?;
862862 } else {
863863 panic!( "Schema and struct disagree on type for {}" , stringify!{ counter } )
@@ -924,14 +924,14 @@ mod test {
924924 let definition_levels : Vec < i16 > = self . iter ( ) . map ( | rec | if rec . optional_str . is_some ( ) { 1 } else { 0 } ) . collect ( ) ;
925925
926926 let vals: Vec <_> = records. iter( ) . filter_map( |rec| {
927- if let Some ( ref inner ) = rec . optional_str {
927+ if let Some ( inner ) = & rec . optional_str {
928928 Some ( ( & inner[ ..] ) . into( ) )
929929 } else {
930930 None
931931 }
932932 } ) . collect( ) ;
933933
934- if let ColumnWriter :: ByteArrayColumnWriter ( ref mut typed ) = column_writer. untyped( ) {
934+ if let ColumnWriter :: ByteArrayColumnWriter ( typed ) = column_writer. untyped( ) {
935935 typed . write_batch ( & vals [ .. ] , Some ( & definition_levels[ ..] ) , None ) ? ;
936936 } else {
937937 panic!( "Schema and struct disagree on type for {}" , stringify ! { optional_str } )
@@ -948,14 +948,14 @@ mod test {
948948 let definition_levels : Vec < i16 > = self . iter ( ) . map ( | rec | if rec . optional_string . is_some ( ) { 1 } else { 0 } ) . collect ( ) ;
949949
950950 let vals: Vec <_> = records. iter( ) . filter_map( |rec| {
951- if let Some ( ref inner ) = rec . optional_string {
951+ if let Some ( inner ) = & rec . optional_string {
952952 Some ( ( & inner[ ..] ) . into( ) )
953953 } else {
954954 None
955955 }
956956 } ) . collect( ) ;
957957
958- if let ColumnWriter :: ByteArrayColumnWriter ( ref mut typed ) = column_writer. untyped( ) {
958+ if let ColumnWriter :: ByteArrayColumnWriter ( typed ) = column_writer. untyped( ) {
959959 typed . write_batch ( & vals [ .. ] , Some ( & definition_levels[ ..] ) , None ) ? ;
960960 } else {
961961 panic!( "Schema and struct disagree on type for {}" , stringify ! { optional_string } )
@@ -978,7 +978,7 @@ mod test {
978978 }
979979 } ) . collect( ) ;
980980
981- if let ColumnWriter :: Int32ColumnWriter ( ref mut typed ) = column_writer. untyped( ) {
981+ if let ColumnWriter :: Int32ColumnWriter ( typed ) = column_writer. untyped( ) {
982982 typed . write_batch ( & vals [ .. ] , Some ( & definition_levels[ ..] ) , None ) ? ;
983983 } else {
984984 panic!( "Schema and struct disagree on type for {}" , stringify ! { optional_dumb_int } )
@@ -1261,7 +1261,7 @@ mod test {
12611261 assert_eq ! ( when. writer_snippet( ) . to_string( ) , ( quote!{
12621262 {
12631263 let vals : Vec <_> = records. iter( ) . map( |rec| rec. henceforth. timestamp_millis( ) ) . collect( ) ;
1264- if let ColumnWriter :: Int64ColumnWriter ( ref mut typed) = column_writer. untyped( ) {
1264+ if let ColumnWriter :: Int64ColumnWriter ( typed) = column_writer. untyped( ) {
12651265 typed. write_batch( & vals[ ..] , None , None ) ?;
12661266 } else {
12671267 panic!( "Schema and struct disagree on type for {}" , stringify!{ henceforth } )
@@ -1281,7 +1281,7 @@ mod test {
12811281 }
12821282 } ) . collect( ) ;
12831283
1284- if let ColumnWriter :: Int64ColumnWriter ( ref mut typed) = column_writer. untyped( ) {
1284+ if let ColumnWriter :: Int64ColumnWriter ( typed) = column_writer. untyped( ) {
12851285 typed. write_batch( & vals[ ..] , Some ( & definition_levels[ ..] ) , None ) ?;
12861286 } else {
12871287 panic!( "Schema and struct disagree on type for {}" , stringify!{ maybe_happened } )
@@ -1335,7 +1335,7 @@ mod test {
13351335 assert_eq ! ( when. writer_snippet( ) . to_string( ) , ( quote!{
13361336 {
13371337 let vals : Vec <_> = records. iter( ) . map( |rec| rec. henceforth. signed_duration_since( :: chrono:: NaiveDate :: from_ymd( 1970 , 1 , 1 ) ) . num_days( ) as i32 ) . collect( ) ;
1338- if let ColumnWriter :: Int32ColumnWriter ( ref mut typed) = column_writer. untyped( ) {
1338+ if let ColumnWriter :: Int32ColumnWriter ( typed) = column_writer. untyped( ) {
13391339 typed. write_batch( & vals[ ..] , None , None ) ?;
13401340 } else {
13411341 panic!( "Schema and struct disagree on type for {}" , stringify!{ henceforth } )
@@ -1355,7 +1355,7 @@ mod test {
13551355 }
13561356 } ) . collect( ) ;
13571357
1358- if let ColumnWriter :: Int32ColumnWriter ( ref mut typed) = column_writer. untyped( ) {
1358+ if let ColumnWriter :: Int32ColumnWriter ( typed) = column_writer. untyped( ) {
13591359 typed. write_batch( & vals[ ..] , Some ( & definition_levels[ ..] ) , None ) ?;
13601360 } else {
13611361 panic!( "Schema and struct disagree on type for {}" , stringify!{ maybe_happened } )
@@ -1409,7 +1409,7 @@ mod test {
14091409 assert_eq ! ( when. writer_snippet( ) . to_string( ) , ( quote!{
14101410 {
14111411 let vals : Vec <_> = records. iter( ) . map( |rec| rec. unique_id. as_bytes( ) . to_vec( ) . into( ) ) . collect( ) ;
1412- if let ColumnWriter :: FixedLenByteArrayColumnWriter ( ref mut typed) = column_writer. untyped( ) {
1412+ if let ColumnWriter :: FixedLenByteArrayColumnWriter ( typed) = column_writer. untyped( ) {
14131413 typed. write_batch( & vals[ ..] , None , None ) ?;
14141414 } else {
14151415 panic!( "Schema and struct disagree on type for {}" , stringify!{ unique_id } )
@@ -1422,14 +1422,14 @@ mod test {
14221422 {
14231423 let definition_levels : Vec <i16 > = self . iter( ) . map( |rec| if rec. maybe_unique_id. is_some( ) { 1 } else { 0 } ) . collect( ) ;
14241424 let vals : Vec <_> = records. iter( ) . filter_map( |rec| {
1425- if let Some ( ref inner) = rec. maybe_unique_id {
1425+ if let Some ( inner) = & rec. maybe_unique_id {
14261426 Some ( ( & inner. to_string( ) [ ..] ) . into( ) )
14271427 } else {
14281428 None
14291429 }
14301430 } ) . collect( ) ;
14311431
1432- if let ColumnWriter :: FixedLenByteArrayColumnWriter ( ref mut typed) = column_writer. untyped( ) {
1432+ if let ColumnWriter :: FixedLenByteArrayColumnWriter ( typed) = column_writer. untyped( ) {
14331433 typed. write_batch( & vals[ ..] , Some ( & definition_levels[ ..] ) , None ) ?;
14341434 } else {
14351435 panic!( "Schema and struct disagree on type for {}" , stringify!{ maybe_unique_id } )
0 commit comments