Skip to content

Commit 2d89966

Browse files
authored
Fix deprecated as_slice() calls in aws-smithy-checksums (#4347)
## Motivation and Context This PR fixes deprecation warnings from the generic-array crate upgrade by replacing deprecated `as_slice()` method calls with `as_ref()`. ## Description - Replaced `as_slice()` with `as_ref()` in SHA1, SHA256, and MD5 checksum implementations - Bumped aws-smithy-checksums version from 0.63.9 to 0.63.10 ## Testing - ✅ `cargo check` passes - ✅ `cargo test` passes (all 20 tests) - ✅ Pre-commit hooks pass ## Checklist - [x] I have updated `Cargo.toml` if I made changes to dependencies - [x] I have updated the version number if I made changes to the crate - [x] I have run `cargo test` locally and it passes - [x] I have run `cargo clippy` locally and it passes Fixes the following compilation warnings: ``` error: use of deprecated method `sha1::digest::generic_array::GenericArray::<T, N>::as_slice`: please upgrade to generic-array 1.x ```
1 parent d4c11dd commit 2d89966

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

rust-runtime/aws-smithy-checksums/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "aws-smithy-checksums"
3-
version = "0.63.9"
3+
version = "0.63.10"
44
authors = [
55
"AWS Rust SDK Team <aws-sdk-rust@amazon.com>",
66
"Zelda Hessler <zhessler@amazon.com>",

rust-runtime/aws-smithy-checksums/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ impl Sha1 {
266266

267267
fn finalize(self) -> Bytes {
268268
use sha1::Digest;
269-
Bytes::copy_from_slice(self.hasher.finalize().as_slice())
269+
Bytes::copy_from_slice(self.hasher.finalize().as_ref())
270270
}
271271

272272
// Size of the checksum in bytes
@@ -302,7 +302,7 @@ impl Sha256 {
302302

303303
fn finalize(self) -> Bytes {
304304
use sha2::Digest;
305-
Bytes::copy_from_slice(self.hasher.finalize().as_slice())
305+
Bytes::copy_from_slice(self.hasher.finalize().as_ref())
306306
}
307307

308308
// Size of the checksum in bytes
@@ -340,7 +340,7 @@ impl Md5 {
340340
#[warn(dead_code)]
341341
fn finalize(self) -> Bytes {
342342
use md5::Digest;
343-
Bytes::copy_from_slice(self.hasher.finalize().as_slice())
343+
Bytes::copy_from_slice(self.hasher.finalize().as_ref())
344344
}
345345

346346
// Size of the checksum in bytes

0 commit comments

Comments
 (0)