Skip to content

Commit 8868c94

Browse files
authored
Bump nightly rust (#1048)
op-rs mirror to stackabletech/operator-templating#524, because I'm tired of constantly keeping score between the two fighting rustfmts.
1 parent 8eea0ad commit 8868c94

File tree

21 files changed

+598
-455
lines changed

21 files changed

+598
-455
lines changed

.github/workflows/pr_pre-commit.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
env:
99
CARGO_TERM_COLOR: always
10-
RUST_TOOLCHAIN_VERSION: "nightly-2025-01-15"
10+
RUST_TOOLCHAIN_VERSION: "nightly-2025-05-26"
1111

1212
permissions: {}
1313

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@ repos:
5656
name: rustfmt
5757
language: system
5858
# Pinning to a specific rustc version, so that we get consistent formatting
59-
entry: cargo +nightly-2025-01-15 fmt --all -- --check
59+
entry: cargo +nightly-2025-05-26 fmt --all -- --check
6060
stages: [pre-commit]
6161
pass_filenames: false

.vscode/settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"rust-analyzer.cargo.features": "all",
33
"rust-analyzer.rustfmt.overrideCommand": [
44
"rustfmt",
5-
"+nightly-2025-01-15",
5+
"+nightly-2025-05-26",
66
"--"
7-
],
7+
]
88
}

crates/stackable-operator-derive/src/merge.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,13 @@ pub fn derive(input: DeriveInput) -> TokenStream {
6767

6868
let (ty, variants) = match data {
6969
// Structs are almost single-variant enums, so we can reuse most of the same matching code for both cases
70-
Data::Struct(fields) => (InputType::Struct, vec![MergeVariant {
71-
ident: Ident::new("__placeholder", Span::call_site()),
72-
fields,
73-
}]),
70+
Data::Struct(fields) => (
71+
InputType::Struct,
72+
vec![MergeVariant {
73+
ident: Ident::new("__placeholder", Span::call_site()),
74+
fields,
75+
}],
76+
),
7477
Data::Enum(variants) => (InputType::Enum, variants),
7578
};
7679
let merge_variants = variants

crates/stackable-operator/src/builder/pdb.rs

Lines changed: 60 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -229,22 +229,28 @@ mod tests {
229229
.with_min_available(42)
230230
.build();
231231

232-
assert_eq!(pdb, PodDisruptionBudget {
233-
metadata: ObjectMeta {
234-
name: Some("trino".to_string()),
235-
namespace: Some("default".to_string()),
236-
..Default::default()
237-
},
238-
spec: Some(PodDisruptionBudgetSpec {
239-
min_available: Some(IntOrString::Int(42)),
240-
selector: Some(LabelSelector {
241-
match_expressions: None,
242-
match_labels: Some(BTreeMap::from([("foo".to_string(), "bar".to_string())])),
232+
assert_eq!(
233+
pdb,
234+
PodDisruptionBudget {
235+
metadata: ObjectMeta {
236+
name: Some("trino".to_string()),
237+
namespace: Some("default".to_string()),
238+
..Default::default()
239+
},
240+
spec: Some(PodDisruptionBudgetSpec {
241+
min_available: Some(IntOrString::Int(42)),
242+
selector: Some(LabelSelector {
243+
match_expressions: None,
244+
match_labels: Some(BTreeMap::from([(
245+
"foo".to_string(),
246+
"bar".to_string()
247+
)])),
248+
}),
249+
..Default::default()
243250
}),
244251
..Default::default()
245-
}),
246-
..Default::default()
247-
})
252+
}
253+
)
248254
}
249255

250256
#[test]
@@ -283,54 +289,57 @@ mod tests {
283289
.with_max_unavailable(2)
284290
.build();
285291

286-
assert_eq!(pdb, PodDisruptionBudget {
287-
metadata: ObjectMeta {
288-
name: Some("simple-trino-worker".to_string()),
289-
namespace: Some("default".to_string()),
290-
labels: Some(BTreeMap::from([
291-
("app.kubernetes.io/name".to_string(), "trino".to_string()),
292-
(
293-
"app.kubernetes.io/instance".to_string(),
294-
"simple-trino".to_string()
295-
),
296-
(
297-
"app.kubernetes.io/managed-by".to_string(),
298-
"trino.stackable.tech_trino-operator-trino-controller".to_string()
299-
),
300-
(
301-
"app.kubernetes.io/component".to_string(),
302-
"worker".to_string()
303-
)
304-
])),
305-
owner_references: Some(vec![
306-
OwnerReferenceBuilder::new()
307-
.initialize_from_resource(&trino)
308-
.block_owner_deletion_opt(None)
309-
.controller_opt(Some(true))
310-
.build()
311-
.unwrap()
312-
]),
313-
..Default::default()
314-
},
315-
spec: Some(PodDisruptionBudgetSpec {
316-
max_unavailable: Some(IntOrString::Int(2)),
317-
selector: Some(LabelSelector {
318-
match_expressions: None,
319-
match_labels: Some(BTreeMap::from([
292+
assert_eq!(
293+
pdb,
294+
PodDisruptionBudget {
295+
metadata: ObjectMeta {
296+
name: Some("simple-trino-worker".to_string()),
297+
namespace: Some("default".to_string()),
298+
labels: Some(BTreeMap::from([
320299
("app.kubernetes.io/name".to_string(), "trino".to_string()),
321300
(
322301
"app.kubernetes.io/instance".to_string(),
323302
"simple-trino".to_string()
324303
),
304+
(
305+
"app.kubernetes.io/managed-by".to_string(),
306+
"trino.stackable.tech_trino-operator-trino-controller".to_string()
307+
),
325308
(
326309
"app.kubernetes.io/component".to_string(),
327310
"worker".to_string()
328311
)
329312
])),
313+
owner_references: Some(vec![
314+
OwnerReferenceBuilder::new()
315+
.initialize_from_resource(&trino)
316+
.block_owner_deletion_opt(None)
317+
.controller_opt(Some(true))
318+
.build()
319+
.unwrap()
320+
]),
321+
..Default::default()
322+
},
323+
spec: Some(PodDisruptionBudgetSpec {
324+
max_unavailable: Some(IntOrString::Int(2)),
325+
selector: Some(LabelSelector {
326+
match_expressions: None,
327+
match_labels: Some(BTreeMap::from([
328+
("app.kubernetes.io/name".to_string(), "trino".to_string()),
329+
(
330+
"app.kubernetes.io/instance".to_string(),
331+
"simple-trino".to_string()
332+
),
333+
(
334+
"app.kubernetes.io/component".to_string(),
335+
"worker".to_string()
336+
)
337+
])),
338+
}),
339+
..Default::default()
330340
}),
331341
..Default::default()
332-
}),
333-
..Default::default()
334-
})
342+
}
343+
)
335344
}
336345
}

crates/stackable-operator/src/builder/pod/container.rs

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,16 @@ impl ContainerBuilder {
120120
name: impl Into<String>,
121121
field_path: FieldPathEnvVar,
122122
) -> &mut Self {
123-
self.add_env_var_from_source(name, EnvVarSource {
124-
field_ref: Some(ObjectFieldSelector {
125-
field_path: field_path.to_string(),
126-
..ObjectFieldSelector::default()
127-
}),
128-
..EnvVarSource::default()
129-
});
123+
self.add_env_var_from_source(
124+
name,
125+
EnvVarSource {
126+
field_ref: Some(ObjectFieldSelector {
127+
field_path: field_path.to_string(),
128+
..ObjectFieldSelector::default()
129+
}),
130+
..EnvVarSource::default()
131+
},
132+
);
130133
self
131134
}
132135

@@ -137,14 +140,17 @@ impl ContainerBuilder {
137140
secret_name: impl Into<String>,
138141
secret_key: impl Into<String>,
139142
) -> &mut Self {
140-
self.add_env_var_from_source(name, EnvVarSource {
141-
secret_key_ref: Some(SecretKeySelector {
142-
name: secret_name.into(),
143-
key: secret_key.into(),
143+
self.add_env_var_from_source(
144+
name,
145+
EnvVarSource {
146+
secret_key_ref: Some(SecretKeySelector {
147+
name: secret_name.into(),
148+
key: secret_key.into(),
149+
..Default::default()
150+
}),
144151
..Default::default()
145-
}),
146-
..Default::default()
147-
});
152+
},
153+
);
148154
self
149155
}
150156

@@ -155,14 +161,17 @@ impl ContainerBuilder {
155161
config_map_name: impl Into<String>,
156162
config_map_key: impl Into<String>,
157163
) -> &mut Self {
158-
self.add_env_var_from_source(name, EnvVarSource {
159-
config_map_key_ref: Some(ConfigMapKeySelector {
160-
name: config_map_name.into(),
161-
key: config_map_key.into(),
164+
self.add_env_var_from_source(
165+
name,
166+
EnvVarSource {
167+
config_map_key_ref: Some(ConfigMapKeySelector {
168+
name: config_map_name.into(),
169+
key: config_map_key.into(),
170+
..Default::default()
171+
}),
162172
..Default::default()
163-
}),
164-
..Default::default()
165-
});
173+
},
174+
);
166175
self
167176
}
168177

crates/stackable-operator/src/builder/pod/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -767,11 +767,12 @@ mod tests {
767767
.build()
768768
.unwrap();
769769

770-
assert_eq!(pod.spec.unwrap().image_pull_secrets.unwrap(), vec![
771-
LocalObjectReference {
770+
assert_eq!(
771+
pod.spec.unwrap().image_pull_secrets.unwrap(),
772+
vec![LocalObjectReference {
772773
name: "company-registry-secret".to_string()
773-
}
774-
]);
774+
}]
775+
);
775776
}
776777

777778
#[rstest]

crates/stackable-operator/src/builder/pod/security.rs

Lines changed: 46 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -365,48 +365,51 @@ mod tests {
365365
.win_run_as_user_name("winuser")
366366
.build();
367367

368-
assert_eq!(context, PodSecurityContext {
369-
fs_group: Some(1000),
370-
fs_group_change_policy: Some("policy".to_string()),
371-
run_as_user: Some(1001),
372-
run_as_group: Some(1001),
373-
run_as_non_root: Some(true),
374-
supplemental_groups: Some(vec![1002, 1003]),
375-
se_linux_options: Some(SELinuxOptions {
376-
level: Some("level".to_string()),
377-
role: Some("role".to_string()),
378-
type_: Some("type".to_string()),
379-
user: Some("user".to_string()),
380-
}),
381-
seccomp_profile: Some(SeccompProfile {
382-
localhost_profile: Some("localhost".to_string()),
383-
type_: "type".to_string(),
384-
}),
385-
sysctls: Some(vec![
386-
Sysctl {
387-
name: "param1".to_string(),
388-
value: "value1".to_string(),
389-
},
390-
Sysctl {
391-
name: "param2".to_string(),
392-
value: "value2".to_string(),
393-
},
394-
]),
395-
windows_options: Some(WindowsSecurityContextOptions {
396-
gmsa_credential_spec: Some("spec".to_string()),
397-
gmsa_credential_spec_name: Some("name".to_string()),
398-
run_as_user_name: Some("winuser".to_string()),
399-
..Default::default()
400-
}),
401-
// This attribute is supported starting with Kubernetes 1.30.
402-
// Because we support older Kubernetes versions as well, we can
403-
// not use it for now, as we would not work on older Kubernetes
404-
// clusters.
405-
app_armor_profile: None,
406-
// This attribute is supported starting with Kubernetes 1.31.
407-
supplemental_groups_policy: None,
408-
// This attribute is supported starting with Kubernetes 1.32.
409-
se_linux_change_policy: None,
410-
});
368+
assert_eq!(
369+
context,
370+
PodSecurityContext {
371+
fs_group: Some(1000),
372+
fs_group_change_policy: Some("policy".to_string()),
373+
run_as_user: Some(1001),
374+
run_as_group: Some(1001),
375+
run_as_non_root: Some(true),
376+
supplemental_groups: Some(vec![1002, 1003]),
377+
se_linux_options: Some(SELinuxOptions {
378+
level: Some("level".to_string()),
379+
role: Some("role".to_string()),
380+
type_: Some("type".to_string()),
381+
user: Some("user".to_string()),
382+
}),
383+
seccomp_profile: Some(SeccompProfile {
384+
localhost_profile: Some("localhost".to_string()),
385+
type_: "type".to_string(),
386+
}),
387+
sysctls: Some(vec![
388+
Sysctl {
389+
name: "param1".to_string(),
390+
value: "value1".to_string(),
391+
},
392+
Sysctl {
393+
name: "param2".to_string(),
394+
value: "value2".to_string(),
395+
},
396+
]),
397+
windows_options: Some(WindowsSecurityContextOptions {
398+
gmsa_credential_spec: Some("spec".to_string()),
399+
gmsa_credential_spec_name: Some("name".to_string()),
400+
run_as_user_name: Some("winuser".to_string()),
401+
..Default::default()
402+
}),
403+
// This attribute is supported starting with Kubernetes 1.30.
404+
// Because we support older Kubernetes versions as well, we can
405+
// not use it for now, as we would not work on older Kubernetes
406+
// clusters.
407+
app_armor_profile: None,
408+
// This attribute is supported starting with Kubernetes 1.31.
409+
supplemental_groups_policy: None,
410+
// This attribute is supported starting with Kubernetes 1.32.
411+
se_linux_change_policy: None,
412+
}
413+
);
411414
}
412415
}

0 commit comments

Comments
 (0)