Skip to content

Commit 1c1c4ef

Browse files
lfranckenightkr
andauthored
Apply suggestions from code review
Thanks @teozkr, that was fast! Co-authored-by: Teo Klestrup Röijezon <[email protected]>
1 parent 77fd391 commit 1c1c4ef

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

kube-core/src/crd.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ pub mod v1 {
1414
fn crd() -> super::apiexts::v1::CustomResourceDefinition;
1515
/// Helper to return the name of this `CustomResourceDefinition` in kubernetes.
1616
///
17-
/// This is not the name of an _instance_ of this custom resource but the definition itself.
18-
fn crd_name() -> String;
17+
/// This is not the name of an _instance_ of this custom resource but the `CustomResourceDefinition` object itself.
18+
fn crd_name() -> &'static str;
1919
/// Helper to generate the api information type for use with the dynamic `Api`
2020
fn api_resource() -> crate::discovery::ApiResource;
2121
}
@@ -33,8 +33,8 @@ pub mod v1beta1 {
3333
fn crd() -> super::apiexts::v1beta1::CustomResourceDefinition;
3434
/// Helper to return the name of this `CustomResourceDefinition` in kubernetes.
3535
///
36-
/// This is not the name of an _instance_ of this custom resource but the definition itself.
37-
fn crd_name() -> String;
36+
/// This is not the name of an _instance_ of this custom resource but the `CustomResourceDefinition` object itself.
37+
fn crd_name() -> &'static str;
3838
/// Helper to generate the api information type for use with the dynamic `Api`
3939
fn api_resource() -> crate::discovery::ApiResource;
4040
}

kube-derive/src/custom_resource.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,8 @@ pub(crate) fn derive(input: proc_macro2::TokenStream) -> proc_macro2::TokenStrea
368368
.expect("valid custom resource from #[kube(attrs..)]")
369369
}
370370

371-
fn crd_name() -> String {
372-
#crd_meta_name.to_string()
371+
fn crd_name() -> &'static str {
372+
#crd_meta_name
373373
}
374374

375375
fn api_resource() -> kube::core::ApiResource {

0 commit comments

Comments
 (0)