Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: Bump Rust edition to 2024 #710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Saul-STFC wants to merge 2 commits into stackabletech:main
base: main
Choose a base branch
Loading
from Saul-STFC:rust-2024-upgrade
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock
View file Open in desktop

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions Cargo.nix
View file Open in desktop

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ resolver = "2"
version = "0.0.0-dev"
authors = ["Stackable GmbH <info@stackable.tech>"]
license = "OSL-3.0"
edition = "2021"
edition = "2024"
repository = "https://github.com/stackabletech/secret-operator"

[workspace.dependencies]
Expand Down
5 changes: 2 additions & 3 deletions rust/krb5-provision-keytab/src/credential_cache.rs
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,9 @@ impl CredentialCache {
.expect("key was just confirmed to exist in cache")))
} else {
tracing::info!("credential not found in cache, generating...");
match mk_value(Ctx {
match TryFutureExt::into_future(mk_value(Ctx {
cache_ref: self.cache_ref.clone(),
})
.into_future()
}))
.await
{
Ok(value) => {
Expand Down
4 changes: 2 additions & 2 deletions rust/operator-binary/src/crd/secret_class/v1alpha1_impl.rs
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl SecretClassBackend {
pub fn refers_to_config_map(
&self,
config_map: &PartialObjectMeta<ConfigMap>,
) -> impl Iterator<Item = SearchNamespaceMatchCondition> {
) -> impl Iterator<Item = SearchNamespaceMatchCondition> + use<> {
let cm_namespace = config_map.metadata.namespace.as_deref();
match self {
Self::K8sSearch(backend) => {
Expand All @@ -40,7 +40,7 @@ impl SecretClassBackend {
pub fn refers_to_secret(
&self,
secret: &PartialObjectMeta<Secret>,
) -> impl Iterator<Item = SearchNamespaceMatchCondition> {
) -> impl Iterator<Item = SearchNamespaceMatchCondition> + use<> {
match self {
Self::AutoTls(backend) => {
(backend.ca.secret == *secret).then_some(SearchNamespaceMatchCondition::True)
Expand Down
4 changes: 2 additions & 2 deletions rust/operator-binary/src/crd/secret_class/v1alpha2_impl.rs
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl SecretClassBackend {
pub fn refers_to_config_map(
&self,
config_map: &PartialObjectMeta<ConfigMap>,
) -> impl Iterator<Item = SearchNamespaceMatchCondition> {
) -> impl Iterator<Item = SearchNamespaceMatchCondition> + use<> {
let cm_namespace = config_map.metadata.namespace.as_deref();
match self {
Self::K8sSearch(backend) => {
Expand All @@ -46,7 +46,7 @@ impl SecretClassBackend {
pub fn refers_to_secret(
&self,
secret: &PartialObjectMeta<Secret>,
) -> impl Iterator<Item = SearchNamespaceMatchCondition> {
) -> impl Iterator<Item = SearchNamespaceMatchCondition> + use<> {
match self {
Self::AutoTls(backend) => {
(backend.ca.secret == *secret).then_some(SearchNamespaceMatchCondition::True)
Expand Down
13 changes: 9 additions & 4 deletions rust/operator-binary/src/utils.rs
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,19 @@ pub fn error_full_message(err: &dyn std::error::Error) -> String {
/// Propagates `Ok(true)` and `Err(_)` from `stream`, otherwise returns `Ok(false)`.
pub async fn trystream_any<S: Stream<Item = Result<bool, E>>, E>(stream: S) -> Result<bool, E> {
pin_mut!(stream);
while let Some(value) = stream.next().await {
if let Ok(true) | Err(_) = value {
return value;
loop {

@sbernauer sbernauer Jun 3, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally found the existing code a bit easier to read to be honest.
But I let you decide if we want to keep it and silence clippy

@Saul-STFC Saul-STFC Jun 3, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me too, I agree

sbernauer reacted with thumbs up emoji

@sbernauer sbernauer Jun 3, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case I suggest we slap a #[allow(clippy::xxx)] at the existing code and keep that

let next_item = stream.next().await;
match next_item {
Some(value) => {
if let Ok(true) | Err(_) = value {
return value;
}
}
None => break,
}
}
Ok(false)
}

/// Concatenate chunks of bytes, short-circuiting on [`Err`].
///
/// This is a byte-oriented equivalent to [`Iterator::collect::<Result<String, _>>`](`Iterator::collect`).
Expand Down
4 changes: 2 additions & 2 deletions rust/p12/Cargo.toml
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
name = "p12"
version.workspace = true
authors = ["hjiayz <hjiayz@gmail.com>", "Marc-Antoine Perennou <Marc-Antoine@Perennou.com>"]
edition = "2021"
edition.workspace = true
keywords = ["pkcs12", "pkcs"]
description = "pure rust pkcs12 tool (Stackable fork)"
homepage = "https://github.com/hjiayz/p12"
repository = "https://github.com/hjiayz/p12"
readme = "README.md"
license = "MIT OR Apache-2.0"
rust-version = "1.56.0"
rust-version = "1.85.0"

# Dependencies are tracked inline for now, to minimize divergence from upstream

Expand Down
4 changes: 2 additions & 2 deletions rust/p12/src/lib.rs
View file Open in desktop

@sbernauer sbernauer Jun 3, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a bit of mixed feelings about touching rust/p12. As documented in rust/p12/README.md it's a fork of https://github.com/hjiayz/p12/. We can hopefully get rid of it eventually.
So it's nice to maintain it, on the other hand this increases the diff to upstream...

Original file line number Diff line number Diff line change
Expand Up @@ -644,12 +644,12 @@ fn pbepkcs12sha1(pass: &[u8], salt: &[u8], iterations: u64, id: u8, size: u64) -
let d = [id; V as usize];
fn get_len(s: usize) -> usize {
let s = s as u64;
(V * ((s + V - 1) / V)) as usize
(V * s.div_ceil(V)) as usize
Comment thread
sbernauer marked this conversation as resolved.
}
let s = salt.iter().cycle().take(get_len(salt.len()));
let p = pass.iter().cycle().take(get_len(pass.len()));
let mut i: Vec<u8> = s.chain(p).cloned().collect();
let c = (size + U - 1) / U;
let c = size.div_ceil(U);
let mut a: Vec<u8> = vec![];
for _ in 1..c {
let ai = pbepkcs12sha1core(&d, &i, &mut a, r);
Expand Down
Loading

AltStyle によって変換されたページ (->オリジナル) /