From 32f27f317e4f65146654c9f63bc6b75c4adb8519 Mon Sep 17 00:00:00 2001 From: Marcel Moura Date: Tue, 11 Jul 2023 17:30:48 -0300 Subject: [PATCH] chore(offchain): suppress rust-clippy warnings Full list of warnings: - avoid warning `large_enum_variant` from cargo clippy on `pub enum MachineOneof`, built from grpc-interfaces. More at https://rust-lang.github.io/rust-clippy/master/index.html#large_enum_variant - allow enum variants with same suffix. More at https://rust-lang.github.io/rust-clippy/master/index.html#enum_variant_names. - allow too many arguments in fn. More at https://rust-lang.github.io/rust-clippy/master/index.html#/too_many_arguments. - allow capitalized acronym. More at https://rust-lang.github.io/rust-clippy/master/index.html#upper_case_acronyms. --- offchain/advance-runner/src/server_manager/error.rs | 1 + offchain/advance-runner/src/snapshot/fs_manager.rs | 1 + offchain/clippy.toml | 2 ++ offchain/dispatcher/src/auth.rs | 1 + offchain/dispatcher/src/dispatcher.rs | 1 + offchain/state-server/src/error.rs | 1 + 6 files changed, 7 insertions(+) create mode 100644 offchain/clippy.toml diff --git a/offchain/advance-runner/src/server_manager/error.rs b/offchain/advance-runner/src/server_manager/error.rs index 883356b7e..d3b5bdf68 100644 --- a/offchain/advance-runner/src/server_manager/error.rs +++ b/offchain/advance-runner/src/server_manager/error.rs @@ -5,6 +5,7 @@ use snafu::Snafu; #[derive(Debug, Snafu)] #[snafu(visibility(pub(super)))] +#[allow(clippy::enum_variant_names)] pub enum ServerManagerError { #[snafu(display("failed to connect to server-manager"))] ConnectionError { source: tonic::transport::Error }, diff --git a/offchain/advance-runner/src/snapshot/fs_manager.rs b/offchain/advance-runner/src/snapshot/fs_manager.rs index 4cb9a2c8e..5c8bedd28 100644 --- a/offchain/advance-runner/src/snapshot/fs_manager.rs +++ b/offchain/advance-runner/src/snapshot/fs_manager.rs @@ -10,6 +10,7 @@ use super::config::FSManagerConfig; use super::{Snapshot, SnapshotManager}; #[derive(Debug, Snafu)] +#[allow(clippy::enum_variant_names)] pub enum FSSnapshotError { #[snafu(display("failed to follow latest symlink"))] ReadLinkError { source: std::io::Error }, diff --git a/offchain/clippy.toml b/offchain/clippy.toml new file mode 100644 index 000000000..f19238120 --- /dev/null +++ b/offchain/clippy.toml @@ -0,0 +1,2 @@ +# This avoids warning `large_enum_variant` on `pub enum MachineOneof`, built from grpc-interfaces. +enum-variant-size-threshold = 2500 diff --git a/offchain/dispatcher/src/auth.rs b/offchain/dispatcher/src/auth.rs index e3a36aa59..d73c90813 100644 --- a/offchain/dispatcher/src/auth.rs +++ b/offchain/dispatcher/src/auth.rs @@ -58,6 +58,7 @@ pub struct AuthEnvCLIConfig { } #[derive(Debug, Clone)] +#[allow(clippy::upper_case_acronyms)] pub enum AuthConfig { Mnemonic { mnemonic: String, diff --git a/offchain/dispatcher/src/dispatcher.rs b/offchain/dispatcher/src/dispatcher.rs index 66f9a77cf..ef4141103 100644 --- a/offchain/dispatcher/src/dispatcher.rs +++ b/offchain/dispatcher/src/dispatcher.rs @@ -121,6 +121,7 @@ pub async fn start( } #[instrument(level = "trace", skip_all)] +#[allow(clippy::too_many_arguments)] async fn process_block( block: &Block, diff --git a/offchain/state-server/src/error.rs b/offchain/state-server/src/error.rs index 82a322184..4b7d52087 100644 --- a/offchain/state-server/src/error.rs +++ b/offchain/state-server/src/error.rs @@ -9,6 +9,7 @@ use url::ParseError; #[derive(Debug, Snafu)] #[snafu(visibility(pub(crate)))] +#[allow(clippy::enum_variant_names)] pub enum StateServerError { #[snafu(display("tonic error"))] TonicError { source: TonicError },