Skip to content

Commit ae1dd11

Browse files
authored
chore(grpc): Remove once_cell dependency (#2354)
1 parent 9873cd4 commit ae1dd11

File tree

4 files changed

+8
-14
lines changed

4 files changed

+8
-14
lines changed

grpc/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ http = "1.1.0"
1414
http-body = "1.0.1"
1515
hyper = { version = "1.6.0", features = ["client", "http2"] }
1616
hyper-util = "0.1.14"
17-
once_cell = "1.19.0"
1817
parking_lot = "0.12.4"
1918
pin-project-lite = "0.2.16"
2019
rand = "0.9"
@@ -43,5 +42,4 @@ allowed_external_types = [
4342
"tonic::*",
4443
"futures_core::stream::Stream",
4544
"tokio::sync::oneshot::Sender",
46-
"once_cell::sync::Lazy",
4745
]

grpc/src/client/load_balancing/registry.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
use std::{
22
collections::HashMap,
3-
sync::{Arc, Mutex},
3+
sync::{Arc, LazyLock, Mutex},
44
};
55

6-
use once_cell::sync::Lazy;
7-
86
use super::LbPolicyBuilder;
97

108
/// A registry to store and retrieve LB policies. LB policies are indexed by
@@ -39,4 +37,4 @@ impl Default for LbPolicyRegistry {
3937

4038
/// The registry used if a local registry is not provided to a channel or if it
4139
/// does not exist in the local registry.
42-
pub static GLOBAL_LB_REGISTRY: Lazy<LbPolicyRegistry> = Lazy::new(LbPolicyRegistry::new);
40+
pub static GLOBAL_LB_REGISTRY: LazyLock<LbPolicyRegistry> = LazyLock::new(LbPolicyRegistry::new);

grpc/src/client/transport/registry.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
use std::{
22
collections::HashMap,
3-
sync::{Arc, Mutex},
3+
sync::{Arc, LazyLock, Mutex},
44
};
55

6-
use once_cell::sync::Lazy;
7-
86
use super::Transport;
97

108
/// A registry to store and retrieve transports. Transports are indexed by
@@ -59,4 +57,5 @@ impl Default for TransportRegistry {
5957

6058
/// The registry used if a local registry is not provided to a channel or if it
6159
/// does not exist in the local registry.
62-
pub static GLOBAL_TRANSPORT_REGISTRY: Lazy<TransportRegistry> = Lazy::new(TransportRegistry::new);
60+
pub static GLOBAL_TRANSPORT_REGISTRY: LazyLock<TransportRegistry> =
61+
LazyLock::new(TransportRegistry::new);

grpc/src/inmemory/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::{
33
ops::Add,
44
sync::{
55
atomic::{AtomicU32, Ordering},
6-
Arc,
6+
Arc, LazyLock,
77
},
88
};
99

@@ -18,7 +18,6 @@ use crate::{
1818
server,
1919
service::{Request, Response, Service},
2020
};
21-
use once_cell::sync::Lazy;
2221
use tokio::sync::{mpsc, oneshot, Mutex, Notify};
2322
use tonic::async_trait;
2423

@@ -93,8 +92,8 @@ impl crate::server::Listener for Arc<Listener> {
9392
}
9493
}
9594

96-
static LISTENERS: Lazy<std::sync::Mutex<HashMap<String, Arc<Listener>>>> =
97-
Lazy::new(std::sync::Mutex::default);
95+
static LISTENERS: LazyLock<std::sync::Mutex<HashMap<String, Arc<Listener>>>> =
96+
LazyLock::new(std::sync::Mutex::default);
9897

9998
struct ClientTransport {}
10099

0 commit comments

Comments
 (0)