@@ -362,6 +362,7 @@ impl Struct {
362362
363363 let struct_ident = & self . common . idents . kubernetes ;
364364 let version_enum_ident = & self . common . idents . kubernetes_version ;
365+ let version_idents = versions. iter ( ) . map ( |v| & v. idents . variant ) ;
365366
366367 let kube_client_path = & * kubernetes_arguments. crates . kube_client ;
367368 let serde_json_path = & * kubernetes_arguments. crates . serde_json ;
@@ -373,7 +374,6 @@ impl Struct {
373374 // Generate conversion paths and the match arms for these paths
374375 let conversion_match_arms =
375376 self . generate_kubernetes_conversion_match_arms ( versions, kubernetes_arguments) ;
376- let noop_match_arm = self . generate_kubernetes_noop_match_arm ( versions) ;
377377
378378 // TODO (@Techassi): Make this a feature, drop the option from the macro arguments
379379 // Generate tracing attributes and events if tracing is enabled
@@ -484,9 +484,17 @@ impl Struct {
484484
485485 match ( current_object, desired_api_version) {
486486 #( #conversion_match_arms, ) *
487+ // In case the desired version matches the current object api version, we
488+ // don't need to do anything.
489+ //
487490 // We explicitly list the remaining no-op cases, so the compiler ensures we
488491 // did not miss a conversion.
489- #noop_match_arm,
492+ //
493+ // NOTE (@Techassi): I'm curious if this will ever happen? In theory the K8s
494+ // apiserver should never send such a conversion review.
495+ #(
496+ ( Self :: #version_idents( _) , #version_enum_ident:: #version_idents)
497+ ) |* => converted_objects. push( object)
490498 }
491499 }
492500
@@ -579,20 +587,6 @@ impl Struct {
579587 . collect ( )
580588 }
581589
582- fn generate_kubernetes_noop_match_arm ( & self , versions : & [ VersionDefinition ] ) -> TokenStream {
583- let version_enum_ident = & self . common . idents . kubernetes_version ;
584- let version_idents = versions. iter ( ) . map ( |v| & v. idents . variant ) ;
585-
586- quote ! {
587- // This is the case if the desired version matches the current object api version.
588- // NOTE (@Techassi): I'm curious if this will ever happen? In theory the K8s
589- // apiserver should never send such a conversion review.
590- #(
591- ( Self :: #version_idents( _) , #version_enum_ident:: #version_idents)
592- ) |* => converted_objects. push( object)
593- }
594- }
595-
596590 fn generate_kubernetes_conversion_tracing (
597591 & self ,
598592 kubernetes_arguments : & KubernetesArguments ,
0 commit comments