Skip to content

Commit ac71ef2

Browse files
committed
Replace lazy_static with once_cell
Same thing basically, but without macros :)
1 parent 5537e70 commit ac71ef2

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ cargo-registry-index = { path = "cargo-registry-index", features = ["testing"] }
8989
claim = { git = "https://github.com/Turbo87/rust-claim.git", rev = "23892a3" }
9090
conduit-test = "=0.10.0"
9191
hyper-tls = "=0.5.0"
92-
lazy_static = "=1.4.0"
92+
once_cell = "=1.13.0"
9393
tokio = "=1.20.1"
9494
tower-service = "=0.3.2"
9595

src/tests/all.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ extern crate claim;
55
#[macro_use]
66
extern crate diesel;
77
#[macro_use]
8-
extern crate lazy_static;
9-
#[macro_use]
108
extern crate serde;
119
#[macro_use]
1210
extern crate serde_json;

src/tests/builders/publish.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ use cargo_registry::views::krate_publish as u;
22
use std::{collections::HashMap, io::Read};
33

44
use flate2::{write::GzEncoder, Compression};
5+
use once_cell::sync::Lazy;
56

67
use super::DependencyBuilder;
78

8-
lazy_static! {
9-
// The bytes of an empty tarball is not an empty vector of bytes because of tarball headers.
10-
// Unless files are added to a PublishBuilder, the `.crate` tarball that gets uploaded
11-
// will be empty, so precompute the empty tarball bytes to use as a default.
12-
static ref EMPTY_TARBALL_BYTES: Vec<u8> = generate_empty_tarball();
13-
}
9+
// The bytes of an empty tarball is not an empty vector of bytes because of tarball headers.
10+
// Unless files are added to a PublishBuilder, the `.crate` tarball that gets uploaded
11+
// will be empty, so precompute the empty tarball bytes to use as a default.
12+
static EMPTY_TARBALL_BYTES: Lazy<Vec<u8>> = Lazy::new(generate_empty_tarball);
1413

1514
fn generate_empty_tarball() -> Vec<u8> {
1615
let mut empty_tarball = vec![];

0 commit comments

Comments
 (0)