Skip to content

Commit 1e0cde4

Browse files
committed
refactor: Use cfg!
1 parent 9136851 commit 1e0cde4

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

crates/stackable-operator/src/cluster_resources.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -671,11 +671,16 @@ impl<'a> ClusterResources<'a> {
671671
/// * `client` - The client which is used to access Kubernetes
672672
pub async fn delete_orphaned_resources(self, client: &Client) -> Result<()> {
673673
// We can only delete Listeners in case the "crds" feature is enabled, otherwise it's a NOP.
674-
#[cfg(feature = "crds")]
675-
let delete_listeners = self
676-
.delete_orphaned_resources_of_kind::<crate::crd::listener::v1alpha1::Listener>(client);
677-
#[cfg(not(feature = "crds"))]
678-
let delete_listeners = async { Ok(()) };
674+
let delete_listeners = async {
675+
if cfg!(feature = "crds") {
676+
self.delete_orphaned_resources_of_kind::<crate::crd::listener::v1alpha1::Listener>(
677+
client,
678+
)
679+
.await
680+
} else {
681+
Ok(())
682+
}
683+
};
679684

680685
tokio::try_join!(
681686
self.delete_orphaned_resources_of_kind::<Service>(client),

0 commit comments

Comments
 (0)