Skip to content

Commit 3a40b5b

Browse files
committed
feat: bump Rust edition to 2024 and apply cargo fix updates
Run `cargo fix --edition` and resolve resulting warnings: - Add `use<>` syntax to `impl Trait` return types (auto-fixed) - Fix temporary drop order change in Rust 2024 by explicitly dropping `_initial_reconcile_rx` + Fixing format on a few files to pass fmt
1 parent 68a2442 commit 3a40b5b

6 files changed

Lines changed: 52 additions & 53 deletions

File tree

Cargo.nix

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ resolver = "2"
66
version = "0.0.0-dev"
77
authors = ["Stackable GmbH <info@stackable.tech>"]
88
license = "OSL-3.0"
9-
edition = "2021"
9+
edition = "2024"
1010
repository = "https://github.com/stackabletech/druid-operator"
1111

1212
[workspace.dependencies]

rust/operator-binary/src/crd/authentication.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,9 @@ impl AuthenticationClassesResolved {
139139
Some(server_and_internal_secret_class) => {
140140
if let Some(auth_class_secret_class) =
141141
&provider.client_cert_secret_class
142+
&& auth_class_secret_class != server_and_internal_secret_class
142143
{
143-
if auth_class_secret_class != server_and_internal_secret_class {
144-
return TlsAuthenticationClassSecretClassDiffersFromDruidServerTlsSnafu { auth_class_name: auth_class_name.to_string(), server_and_internal_secret_class: server_and_internal_secret_class.clone() }.fail()?;
145-
}
144+
return TlsAuthenticationClassSecretClassDiffersFromDruidServerTlsSnafu { auth_class_name: auth_class_name.to_string(), server_and_internal_secret_class: server_and_internal_secret_class.clone() }.fail()?;
146145
}
147146
}
148147
None => {
@@ -231,10 +230,10 @@ impl AuthenticationClassesResolved {
231230
}
232231

233232
pub fn tls_authentication_enabled(&self) -> bool {
234-
if !self.auth_classes.is_empty() {
235-
if let Some(AuthenticationClassResolved::Tls { .. }) = self.auth_classes.first() {
236-
return true;
237-
}
233+
if !self.auth_classes.is_empty()
234+
&& let Some(AuthenticationClassResolved::Tls { .. }) = self.auth_classes.first()
235+
{
236+
return true;
238237
}
239238
false
240239
}

rust/operator-binary/src/crd/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ impl v1alpha1::DruidCluster {
457457
(
458458
Vec<PropertyNameKind>,
459459
Role<
460-
impl Configuration<Configurable = v1alpha1::DruidCluster>,
460+
impl Configuration<Configurable = v1alpha1::DruidCluster> + use<>,
461461
DruidConfigOverrides,
462462
GenericRoleConfig,
463463
JavaCommonConfig,
@@ -725,7 +725,7 @@ impl v1alpha1::DruidCluster {
725725
&self,
726726
druid_role: &DruidRole,
727727
) -> Role<
728-
impl Configuration<Configurable = v1alpha1::DruidCluster>,
728+
impl Configuration<Configurable = v1alpha1::DruidCluster> + use<>,
729729
DruidConfigOverrides,
730730
GenericRoleConfig,
731731
JavaCommonConfig,
@@ -1043,10 +1043,10 @@ impl DruidRole {
10431043
) -> Vec<String> {
10441044
let mut commands = vec![];
10451045

1046-
if let Some(s3) = s3 {
1047-
if let Some(ca_cert_file) = s3.tls.tls_ca_cert_mount_path() {
1048-
commands.extend(add_cert_to_jvm_trust_store_cmd(&ca_cert_file));
1049-
}
1046+
if let Some(s3) = s3
1047+
&& let Some(ca_cert_file) = s3.tls.tls_ca_cert_mount_path()
1048+
{
1049+
commands.extend(add_cert_to_jvm_trust_store_cmd(&ca_cert_file));
10501050
}
10511051

10521052
// copy druid config to rw config

rust/operator-binary/src/druid_controller.rs

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -621,46 +621,46 @@ pub async fn reconcile_druid(
621621
);
622622
}
623623

624-
if let Some(listener_class) = druid_role.listener_class_name(druid) {
625-
if let Some(listener_group_name) = group_listener_name(druid, &druid_role) {
626-
let role_group_listener = build_group_listener(
624+
if let Some(listener_class) = druid_role.listener_class_name(druid)
625+
&& let Some(listener_group_name) = group_listener_name(druid, &druid_role)
626+
{
627+
let role_group_listener = build_group_listener(
628+
druid,
629+
build_recommended_labels(
627630
druid,
628-
build_recommended_labels(
629-
druid,
630-
DRUID_CONTROLLER_NAME,
631-
&resolved_product_image.app_version_label_value,
632-
role_name,
633-
"none",
634-
),
635-
listener_class.to_string(),
636-
listener_group_name,
637-
&druid_role,
638-
&druid_tls_security,
639-
)
640-
.context(ListenerConfigurationSnafu)?;
631+
DRUID_CONTROLLER_NAME,
632+
&resolved_product_image.app_version_label_value,
633+
role_name,
634+
"none",
635+
),
636+
listener_class.to_string(),
637+
listener_group_name,
638+
&druid_role,
639+
&druid_tls_security,
640+
)
641+
.context(ListenerConfigurationSnafu)?;
641642

642-
let listener = cluster_resources
643-
.add(client, role_group_listener)
644-
.await
645-
.context(ApplyGroupListenerSnafu)?;
643+
let listener = cluster_resources
644+
.add(client, role_group_listener)
645+
.await
646+
.context(ApplyGroupListenerSnafu)?;
646647

647-
if druid_role == DruidRole::Router {
648-
// discovery
649-
for discovery_cm in build_discovery_configmaps(
650-
druid,
651-
druid,
652-
&resolved_product_image,
653-
&druid_tls_security,
654-
listener,
655-
)
656-
.await
657-
.context(BuildDiscoveryConfigSnafu)?
658-
{
659-
cluster_resources
660-
.add(client, discovery_cm)
661-
.await
662-
.context(ApplyDiscoveryConfigSnafu)?;
663-
}
648+
if druid_role == DruidRole::Router {
649+
// discovery
650+
for discovery_cm in build_discovery_configmaps(
651+
druid,
652+
druid,
653+
&resolved_product_image,
654+
&druid_tls_security,
655+
listener,
656+
)
657+
.await
658+
.context(BuildDiscoveryConfigSnafu)?
659+
{
660+
cluster_resources
661+
.add(client, discovery_cm)
662+
.await
663+
.context(ApplyDiscoveryConfigSnafu)?;
664664
}
665665
}
666666
}

rust/operator-binary/src/webhooks/conversion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub async fn create_webhook_server(
3737
field_manager: FIELD_MANAGER.to_owned(),
3838
};
3939

40-
let (conversion_webhook, _initial_reconcile_rx) =
40+
let (conversion_webhook, _) =
4141
ConversionWebhook::new(crds_and_handlers, client, conversion_webhook_options);
4242

4343
let webhook_server_options = WebhookServerOptions {

0 commit comments

Comments
 (0)