Skip to content

Commit 854efec

Browse files
Replace once_cell with std::sync::LazyLock in aws-sigv4 (#4050)
## Motivation and Context <!--- Why is this change required? What problem does it solve? --> <!--- If it fixes an open issue, please link to the issue here --> Replaces an external dependency with functionality provided by `std` ## Description <!--- Describe your changes in detail --> ## Testing <!--- Please describe in detail how you tested your changes --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> ## Checklist <!--- If a checkbox below is not applicable, then please DELETE it rather than leaving it unchecked --> - [x] For changes to the AWS SDK, generated SDK code, or SDK runtime crates, I have created a changelog entry Markdown file in the `.changelog` directory, specifying "aws-sdk-rust" in the `applies_to` key. ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._ --------- Co-authored-by: Landon James <lnj@amazon.com>
1 parent 0025462 commit 854efec

File tree

37 files changed

+1753
-312
lines changed

37 files changed

+1753
-312
lines changed

.changelog/1742160441.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
applies_to:
3+
- aws-sdk-rust
4+
authors:
5+
- FalkWoldmann
6+
references: []
7+
breaking: false
8+
new_feature: false
9+
bug_fix: false
10+
---
11+
Removes the once_cell crate from the aws-sigv4 crate

.changelog/1742673776.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
applies_to:
3+
- client
4+
- server
5+
authors:
6+
- FalkWoldmann
7+
references: []
8+
breaking: false
9+
new_feature: false
10+
bug_fix: false
11+
---
12+
Removes the once_cell crate from the rust-runtime crates

.changelog/1742674486.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
applies_to:
3+
- aws-sdk-rust
4+
authors:
5+
- FalkWoldmann
6+
references: []
7+
breaking: false
8+
new_feature: false
9+
bug_fix: false
10+
---
11+
Removes the once_cell crate from the `rust-runtime` crate

.changelog/1742674773.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
applies_to: []
3+
authors:
4+
- FalkWoldmann
5+
references: []
6+
breaking: false
7+
new_feature: false
8+
bug_fix: false
9+
---
10+
Removes the once_cell crate from the tools crates

aws/rust-runtime/Cargo.lock

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

aws/rust-runtime/aws-config/Cargo.lock

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

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "aws-runtime"
3-
version = "1.5.6"
3+
version = "1.5.7"
44
authors = ["AWS Rust SDK Team <aws-sdk-rust@amazon.com>"]
55
description = "Runtime support code for the AWS SDK. This crate isn't intended to be used directly."
66
edition = "2021"
@@ -31,7 +31,6 @@ http-02x = { package = "http", version = "0.2.9" }
3131
http-body-04x = { package = "http-body", version = "0.4.5" }
3232
http-1x = { package = "http", version = "1.1.0", optional = true }
3333
http-body-1x = { package = "http-body", version = "1.0.0", optional = true }
34-
once_cell = "1.20.1"
3534
percent-encoding = "2.3.1"
3635
pin-project-lite = "0.2.14"
3736
regex-lite = { version = "0.1.5", optional = true }

aws/rust-runtime/aws-runtime/src/user_agent/metrics.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
use crate::sdk_feature::AwsSdkFeature;
77
use aws_smithy_runtime::client::sdk_feature::SmithySdkFeature;
8-
use once_cell::sync::Lazy;
98
use std::borrow::Cow;
109
use std::collections::HashMap;
1110
use std::fmt;
11+
use std::sync::LazyLock;
1212

1313
const MAX_COMMA_SEPARATED_METRICS_VALUES_LENGTH: usize = 1024;
1414
#[allow(dead_code)]
@@ -92,8 +92,8 @@ impl Iterator for Base64Iterator {
9292
}
9393
}
9494

95-
pub(super) static FEATURE_ID_TO_METRIC_VALUE: Lazy<HashMap<BusinessMetric, Cow<'static, str>>> =
96-
Lazy::new(|| {
95+
pub(super) static FEATURE_ID_TO_METRIC_VALUE: LazyLock<HashMap<BusinessMetric, Cow<'static, str>>> =
96+
LazyLock::new(|| {
9797
let mut m = HashMap::new();
9898
for (metric, value) in BusinessMetric::iter()
9999
.cloned()

aws/rust-runtime/aws-runtime/src/user_agent/test_util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55

66
//! Utilities for testing the User-Agent header
77
8-
use once_cell::sync::Lazy;
98
use regex_lite::Regex;
9+
use std::sync::LazyLock;
1010

1111
// regular expression pattern for base64 numeric values
1212
#[allow(dead_code)]
13-
static RE: Lazy<Regex> = Lazy::new(|| Regex::new(r"m/([A-Za-z0-9+/=_,-]+)").unwrap());
13+
static RE: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"m/([A-Za-z0-9+/=_,-]+)").unwrap());
1414

1515
/// Asserts `user_agent` contains all metric values `values`
1616
///

aws/rust-runtime/aws-sigv4/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "aws-sigv4"
3-
version = "1.3.0"
3+
version = "1.3.1"
44
authors = ["AWS Rust SDK Team <aws-sdk-rust@amazon.com>", "David Barsky <me@davidbarsky.com>"]
55
description = "SigV4 signer for HTTP requests and Event Stream messages."
66
edition = "2021"
@@ -28,7 +28,6 @@ hex = "0.4.3"
2828
hmac = "0.12"
2929
http0 = { version = "0.2.9", optional = true, package = "http" }
3030
http = { version = "1.1.0", optional = true }
31-
once_cell = "1.20.1"
3231
p256 = { version = "0.11", features = ["ecdsa"], optional = true }
3332
percent-encoding = { version = "2.3.1", optional = true }
3433
ring = { version = "0.17.5", optional = true }

0 commit comments

Comments
 (0)