Skip to content

Commit bec661a

Browse files
committed
Fix new code
1 parent 3f173e0 commit bec661a

3 files changed

Lines changed: 28 additions & 25 deletions

File tree

crates/stackable-operator/src/commons/tls_verification.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,11 @@ impl std::ops::Deref for TlsClientDetailsWithSecureDefaults {
6060
// exactly one non-zero-sized field, so adding a second real field to either struct
6161
// is a compile error. The only scenario that would NOT be caught at compile time is
6262
// deliberately removing `#[repr(transparent)]` from one of the two structs.
63-
unsafe { &*(self as *const Self as *const TlsClientDetails) }
63+
unsafe { &*std::ptr::from_ref(self).cast::<TlsClientDetails>() }
6464
}
6565
}
6666

67+
#[expect(clippy::unnecessary_wraps)]
6768
fn default_web_pki_tls() -> Option<Tls> {
6869
Some(Tls {
6970
verification: TlsVerification::Server(TlsServerVerification {

crates/stackable-operator/src/crd/git_sync/v1alpha2_impl.rs

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,7 @@ secret:
12011201
}
12021202

12031203
#[test]
1204+
#[allow(clippy::too_many_lines)]
12041205
fn test_git_sync_ca_cert() {
12051206
let git_sync_spec = r#"
12061207
# GitSync using SSH
@@ -1324,7 +1325,7 @@ volumeMounts:
13241325
assert_eq!(1, git_sync_resources.git_sync_init_containers.len());
13251326

13261327
assert_eq!(
1327-
r#"args:
1328+
r"args:
13281329
- |-
13291330
mkdir --parents /stackable/log/git-sync-0-init && exec > >(tee /stackable/log/git-sync-0-init/container.stdout.log) 2> >(tee /stackable/log/git-sync-0-init/container.stderr.log >&2)
13301331
/stackable/git-sync --depth=3 --git-config='http.sslCAInfo:/stackable/gitca-0/ca.crt,safe.directory:/tmp/git' --link=current --one-time=true --period=60s --ref=trunk --repo=ssh://git@github.com/stackabletech/repo.git --rev=HEAD --root=/tmp/git
@@ -1356,7 +1357,7 @@ volumeMounts:
13561357
name: extra-volume
13571358
- mountPath: /stackable/gitca-0
13581359
name: ca-cert-0
1359-
"#,
1360+
",
13601361
serde_yaml::to_string(&git_sync_resources.git_sync_init_containers.first()).unwrap()
13611362
);
13621363

@@ -1414,109 +1415,109 @@ name: ca-cert-0
14141415
// https with tls/null --> deactivate: Ok
14151416
#[case(
14161417
"https://github.com/stackabletech/repo1",
1417-
r#"
1418+
"
14181419
tls: null
1419-
"#,
1420+
",
14201421
true
14211422
)]
14221423
// https with no tls --> defaults to webPki: Ok
14231424
#[case(
14241425
"https://github.com/stackabletech/repo1",
1425-
r#"
1426-
"#,
1426+
"
1427+
",
14271428
true
14281429
)]
14291430
// http with no tls --> defaults to webPki: Error
14301431
#[case(
14311432
"http://github.com/stackabletech/repo1",
1432-
r#"
1433-
"#,
1433+
"
1434+
",
14341435
false
14351436
)]
14361437
// https with tls/None: Ok
14371438
#[case(
14381439
"https://github.com/stackabletech/repo1",
1439-
r#"
1440+
"
14401441
tls:
14411442
verification:
14421443
none: {}
1443-
"#,
1444+
",
14441445
true
14451446
)]
14461447
// https with tls/None: Error
14471448
#[case(
14481449
"http://github.com/stackabletech/repo1",
1449-
r#"
1450+
"
14501451
tls:
1451-
"#,
1452+
",
14521453
true
14531454
)]
14541455
// ssh with tls/secret: Ok
14551456
#[case(
14561457
"ssh://git@github.com/stackabletech/repo.git",
1457-
r#"
1458+
"
14581459
tls:
14591460
verification:
14601461
server:
14611462
caCert:
14621463
secretClass: git-tls-ca
1463-
"#,
1464+
",
14641465
true
14651466
)]
14661467
// https with tls/secret: Ok
14671468
#[case(
14681469
"https://github.com/stackabletech/repo1",
1469-
r#"
1470+
"
14701471
tls:
14711472
verification:
14721473
server:
14731474
caCert:
14741475
secretClass: another-ca
1475-
"#,
1476+
",
14761477
true
14771478
)]
14781479
// https with tls/webPki: Ok
14791480
#[case(
14801481
"https://github.com/stackabletech/repo1",
1481-
r#"
1482+
"
14821483
tls:
14831484
verification:
14841485
server:
14851486
caCert:
14861487
webPki: {}
1487-
"#,
1488+
",
14881489
true
14891490
)]
14901491
// http with tls/webPki: Error
14911492
#[case(
14921493
"http://github.com/stackabletech/repo1",
1493-
r#"
1494+
"
14941495
tls:
14951496
verification:
14961497
server:
14971498
caCert:
14981499
webPki: {}
1499-
"#,
1500+
",
15001501
false
15011502
)]
15021503
// http with tls/secret: Error
15031504
#[case(
15041505
"http://github.com/stackabletech/repo1",
1505-
r#"
1506+
"
15061507
tls:
15071508
verification:
15081509
server:
15091510
caCert:
15101511
secretClass: http-ca
1511-
"#,
1512+
",
15121513
false
15131514
)]
15141515
fn test_git_sync_tls_scheme(#[case] repo: &str, #[case] tls: &str, #[case] expect_ok: bool) {
15151516
let git_sync_spec = format!(
1516-
r#"
1517+
"
15171518
- repo: {repo}
15181519
{tls}
1519-
"#
1520+
"
15201521
);
15211522

15221523
let git_syncs: Vec<GitSync> = yaml_from_str_singleton_map(&git_sync_spec).unwrap();

crates/stackable-versioned-macros/src/attrs/container.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ pub struct StructCrdArguments {
8585
//
8686
// TODO (@Techassi): This should eventually get replaced by directly using what `kube_derive` offers,
8787
// but that requires an upstream restructure I'm planning to do soon(ish).
88+
#[expect(clippy::struct_field_names)]
8889
#[derive(Clone, Debug, FromMeta)]
8990
pub struct Scale {
9091
pub spec_replicas_path: String,

0 commit comments

Comments
 (0)