Skip to content

Commit 2b0bcee

Browse files
authored
Bump rand from 0.9 to 0.10 and sha2 from 0.10 to 0.11 (#497)
* Bump rand from 0.9 to 0.10 and sha2 from 0.10 to 0.11 - rand 0.10: Replace `rng.sample(distribution)` with `distribution.sample(&mut rng)` (Rng::sample was removed) - sha2 0.11: finalize() now returns hybrid-array Array which doesn't implement LowerHex, use fold with write! instead * Fix rustfmt formatting * Use const_hex::encode for sha2 digest formatting
1 parent 8480201 commit 2b0bcee

5 files changed

Lines changed: 113 additions & 18 deletions

File tree

Cargo.lock

Lines changed: 107 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

buildpacks/ruby/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ libherokubuildpack = { version = "0.30", default-features = false, features = [
2020
"digest",
2121
"download",
2222
] }
23-
rand = "0.9"
23+
rand = "0.10"
2424
# TODO: Consolidate on either the regex crate or the fancy-regex crate, since this repo currently uses both.
2525
regex = "1"
2626
serde = "1"

buildpacks/ruby/src/steps/default_env.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use libcnb::{
77
data::{layer_name, store::Store},
88
layer_env::Scope,
99
};
10-
use rand::Rng;
10+
use rand::distr::{Alphanumeric, Distribution};
1111

1212
// Set default environment values
1313
pub(crate) fn default_env(
@@ -31,7 +31,7 @@ pub(crate) fn default_env(
3131
let mut rng = rand::rng();
3232

3333
(0..64)
34-
.map(|_| rng.sample(rand::distr::Alphanumeric) as char)
34+
.map(|_| Alphanumeric.sample(&mut rng) as char)
3535
.collect::<String>()
3636
.into()
3737
})

commons/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ workspace = true
99
[dependencies]
1010
cache_diff.workspace = true
1111
byte-unit = "5"
12+
const-hex = "1"
1213
# TODO: Consolidate on either the regex crate or the fancy-regex crate, since this repo currently uses both.
1314
fancy-regex = "0.17"
1415
fs_extra = "1"
@@ -17,7 +18,7 @@ glob = "0.3"
1718
libcnb = "0.30"
1819
regex = "1"
1920
serde = "1"
20-
sha2 = "0.10"
21+
sha2 = "0.11"
2122
tempfile = "3"
2223
thiserror = "2"
2324
walkdir = "2"

commons/src/metadata_digest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ fn sha_from_env(env: &Env) -> ShaString {
441441
fn sha_from_string(str: &str) -> ShaString {
442442
let mut hasher = sha2::Sha256::new();
443443
hasher.update(str);
444-
ShaString(format!("{:x}", hasher.finalize()))
444+
ShaString(const_hex::encode(hasher.finalize()))
445445
}
446446

447447
#[cfg(test)]

0 commit comments

Comments
 (0)