Skip to content

Commit 54f0fae

Browse files
authored
chore: disallow async locks (RwLock) (#2144)
1 parent 8c2e0c9 commit 54f0fae

File tree

14 files changed

+16
-1
lines changed

14 files changed

+16
-1
lines changed

clippy.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ disallowed-methods = [
1212
{ path = "crossbeam_channel::unbounded", reason = "Using an unbounded channel most likely will read to unbounded memory growth. Please use a bounded channel instead. If you are intentionally using unbounded channel, use `#[allow(clippy::disallowed_methods)]` to locally disable this check." },
1313
]
1414
disallowed-types = [
15-
{ path = "tokio::sync::Mutex", reason = "You should only use an asynchronous lock if you need to .await something while the lock is locked. Usually, this is not necessary, and you should avoid using an asynchronous lock when you can. Asynchronous locks are a lot slower than blocking locks. Please read how to share state effectively across async tasks https://tokio.rs/tokio/tutorial/shared-state. If you are intentionally using an async mutex, use `#[allow(clippy::disallowed_types)]` to locally disable this check." },
15+
{ path = "tokio::sync::Mutex", reason = "You should only use an asynchronous lock if you need to .await something while the lock is locked. Usually, this is not necessary, and you should avoid using an asynchronous lock when you can. Asynchronous locks are a lot slower than blocking locks. Please read how to share state effectively across async tasks https://tokio.rs/tokio/tutorial/shared-state. If you are intentionally using an async Mutex, use `#[allow(clippy::disallowed_types)]` to locally disable this check." },
16+
{ path = "tokio::sync::RwLock", reason = "You should only use an asynchronous lock if you need to .await something while the lock is locked. Usually, this is not necessary, and you should avoid using an asynchronous lock when you can. Asynchronous locks are a lot slower than blocking locks. Please read how to share state effectively across async tasks https://tokio.rs/tokio/tutorial/shared-state. If you are intentionally using an async RwLock, use `#[allow(clippy::disallowed_types)]` to locally disable this check." },
1617
]

rs/boundary_node/ic_boundary/src/core.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(clippy::disallowed_types)]
12
use std::{
23
error::Error as StdError,
34
net::{Ipv6Addr, SocketAddr},

rs/boundary_node/ic_boundary/src/metrics.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::disallowed_types)]
2+
13
use std::{sync::Arc, time::Instant};
24

35
use anyhow::Error;

rs/monitoring/metrics/src/adapter_metrics_registry.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(clippy::disallowed_types)]
12
use crate::buckets::{add_bucket, decimal_buckets};
23
use futures::future::join_all;
34
use futures::future::FutureExt;

rs/orchestrator/src/dashboard.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(clippy::disallowed_types)]
12
use crate::{
23
catch_up_package_provider::CatchUpPackageProvider, process_manager::ProcessManager,
34
registry_helper::RegistryHelper, ssh_access_manager::SshAccessParameters,

rs/orchestrator/src/firewall.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(clippy::disallowed_types)]
12
use crate::{
23
catch_up_package_provider::CatchUpPackageProvider,
34
error::{OrchestratorError, OrchestratorResult},

rs/orchestrator/src/ipv4_network.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(clippy::disallowed_types)]
12
use crate::{
23
error::{OrchestratorError, OrchestratorResult},
34
metrics::OrchestratorMetrics,

rs/orchestrator/src/orchestrator.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(clippy::disallowed_types)]
12
use crate::{
23
args::OrchestratorArgs,
34
boundary_node::BoundaryNodeManager,

rs/orchestrator/src/ssh_access_manager.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(clippy::disallowed_types)]
12
use crate::{
23
error::{OrchestratorError, OrchestratorResult},
34
metrics::OrchestratorMetrics,

rs/pocket_ic_server/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(clippy::disallowed_types)]
12
use aide::{
23
axum::{
34
routing::{get, post},

0 commit comments

Comments
 (0)