@@ -362,6 +362,7 @@ impl Struct {
362
362
363
363
let struct_ident = & self . common . idents . kubernetes ;
364
364
let version_enum_ident = & self . common . idents . kubernetes_version ;
365
+ let version_idents = versions. iter ( ) . map ( |v| & v. idents . variant ) ;
365
366
366
367
let kube_client_path = & * kubernetes_arguments. crates . kube_client ;
367
368
let serde_json_path = & * kubernetes_arguments. crates . serde_json ;
@@ -373,7 +374,6 @@ impl Struct {
373
374
// Generate conversion paths and the match arms for these paths
374
375
let conversion_match_arms =
375
376
self . generate_kubernetes_conversion_match_arms ( versions, kubernetes_arguments) ;
376
- let noop_match_arm = self . generate_kubernetes_noop_match_arm ( versions) ;
377
377
378
378
// TODO (@Techassi): Make this a feature, drop the option from the macro arguments
379
379
// Generate tracing attributes and events if tracing is enabled
@@ -484,9 +484,17 @@ impl Struct {
484
484
485
485
match ( current_object, desired_api_version) {
486
486
#( #conversion_match_arms, ) *
487
+ // In case the desired version matches the current object api version, we
488
+ // don't need to do anything.
489
+ //
487
490
// We explicitly list the remaining no-op cases, so the compiler ensures we
488
491
// 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)
490
498
}
491
499
}
492
500
@@ -579,20 +587,6 @@ impl Struct {
579
587
. collect ( )
580
588
}
581
589
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
-
596
590
fn generate_kubernetes_conversion_tracing (
597
591
& self ,
598
592
kubernetes_arguments : & KubernetesArguments ,
0 commit comments