Skip to content

Commit 850da79

Browse files
author
Chojan Shang
authored
backend/s3: Change from lazy_static to once_cell (#62)
1 parent dee9fc9 commit 850da79

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ aws-config = "0.6.0"
3737
blocking = "1.1.0"
3838
anyhow = "1"
3939
reqwest = "0.11"
40-
lazy_static = "1"
40+
once_cell = "1"
4141

4242
[dev-dependencies]
4343
uuid = { version = "0.8", features = ["serde", "v4"] }

src/services/s3.rs

+10-12
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use aws_smithy_http::byte_stream::ByteStream;
3232
use aws_smithy_http::result::SdkError;
3333
use futures::TryStreamExt;
3434
use http::{HeaderValue, StatusCode};
35-
use lazy_static::lazy_static;
35+
use once_cell::sync::Lazy;
3636

3737
use crate::credential::Credential;
3838
use crate::error::Error;
@@ -48,17 +48,15 @@ use crate::readers::ReaderStream;
4848
use crate::Accessor;
4949
use crate::BoxedAsyncReader;
5050

51-
lazy_static! {
52-
static ref ENDPOINT_TEMPLATES: HashMap<&'static str, &'static str> = {
53-
let mut m = HashMap::new();
54-
// AWS S3 Service.
55-
m.insert(
56-
"https://s3.amazonaws.com",
57-
"https://s3.{region}.amazonaws.com",
58-
);
59-
m
60-
};
61-
}
51+
static ENDPOINT_TEMPLATES: Lazy<HashMap<&'static str, &'static str>> = Lazy::new(|| {
52+
let mut m = HashMap::new();
53+
// AWS S3 Service.
54+
m.insert(
55+
"https://s3.amazonaws.com",
56+
"https://s3.{region}.amazonaws.com",
57+
);
58+
m
59+
});
6260

6361
/// # TODO
6462
///

0 commit comments

Comments
 (0)