From 03b8c931c482f6f7f5018f4cfee290013aac34e1 Mon Sep 17 00:00:00 2001 From: Green Baneling Date: Tue, 18 Jul 2023 12:21:53 +0300 Subject: [PATCH] Treat warnings like an error (#1258) The fix for [failed publishing](https://github.com/FuelLabs/fuel-core/actions/runs/5581278182) --- .github/workflows/ci.yml | 2 ++ bin/fuel-core-client/src/main.rs | 2 ++ bin/fuel-core/src/main.rs | 1 + crates/chain-config/src/lib.rs | 1 + crates/client/src/client.rs | 2 +- crates/client/src/lib.rs | 1 + crates/database/src/lib.rs | 1 + crates/fuel-core/src/lib.rs | 1 + crates/fuel-core/src/service/adapters/block_importer.rs | 5 ++--- crates/metrics/src/lib.rs | 1 + crates/services/consensus_module/bft/src/lib.rs | 1 + crates/services/consensus_module/poa/src/lib.rs | 1 + crates/services/consensus_module/src/lib.rs | 1 + crates/services/executor/src/lib.rs | 1 + crates/services/importer/src/lib.rs | 1 + crates/services/producer/src/lib.rs | 1 + crates/services/relayer/src/lib.rs | 1 + crates/services/src/lib.rs | 1 + crates/services/sync/src/lib.rs | 1 + crates/services/txpool/src/lib.rs | 1 + crates/storage/src/lib.rs | 1 + crates/types/src/lib.rs | 1 + xtask/src/main.rs | 1 + 23 files changed, 26 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c04e9420cfc..a6427d428cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -86,6 +86,8 @@ jobs: - prevent-openssl - rustfmt runs-on: buildjet-4vcpu-ubuntu-2204 + env: + RUSTFLAGS: -D warnings strategy: matrix: include: diff --git a/bin/fuel-core-client/src/main.rs b/bin/fuel-core-client/src/main.rs index 81e55797c48..c1f398854b0 100644 --- a/bin/fuel-core-client/src/main.rs +++ b/bin/fuel-core-client/src/main.rs @@ -1,4 +1,6 @@ #![deny(unused_crate_dependencies)] +#![deny(warnings)] + use clap::Parser; use fuel_core_client::client::FuelClient; use fuel_core_types::fuel_tx::{ diff --git a/bin/fuel-core/src/main.rs b/bin/fuel-core/src/main.rs index 70c25bc7846..ec25651588f 100644 --- a/bin/fuel-core/src/main.rs +++ b/bin/fuel-core/src/main.rs @@ -1,4 +1,5 @@ #![deny(unused_crate_dependencies)] +#![deny(warnings)] // Use Jemalloc for main binary #[global_allocator] diff --git a/crates/chain-config/src/lib.rs b/crates/chain-config/src/lib.rs index cc8a238a95c..87e4faf8c9a 100644 --- a/crates/chain-config/src/lib.rs +++ b/crates/chain-config/src/lib.rs @@ -1,4 +1,5 @@ #![deny(unused_crate_dependencies)] +#![deny(warnings)] pub mod config; mod genesis; diff --git a/crates/client/src/client.rs b/crates/client/src/client.rs index 3a8aa981948..340fb15aed6 100644 --- a/crates/client/src/client.rs +++ b/crates/client/src/client.rs @@ -857,7 +857,7 @@ impl FuelClient { commit_block_id: Option<&BlockId>, commit_block_height: Option, ) -> io::Result> { - let transaction_id: schema::TransactionId = (*transaction_id).into(); + let transaction_id: TransactionId = (*transaction_id).into(); let message_id: schema::MessageId = (*message_id).into(); let commit_block_id: Option = commit_block_id.map(|commit_block_id| (*commit_block_id).into()); diff --git a/crates/client/src/lib.rs b/crates/client/src/lib.rs index 48eb3f40c44..650ea7e85f6 100644 --- a/crates/client/src/lib.rs +++ b/crates/client/src/lib.rs @@ -1,4 +1,5 @@ #![deny(unused_crate_dependencies)] +#![deny(warnings)] pub mod client; #[cfg(feature = "dap")] pub mod schema; diff --git a/crates/database/src/lib.rs b/crates/database/src/lib.rs index d67824cd699..3d9bfffa4c1 100644 --- a/crates/database/src/lib.rs +++ b/crates/database/src/lib.rs @@ -6,6 +6,7 @@ #![deny(missing_docs)] #![deny(unused_crate_dependencies)] +#![deny(warnings)] use fuel_core_storage::Error as StorageError; use fuel_core_types::services::executor::Error as ExecutorError; diff --git a/crates/fuel-core/src/lib.rs b/crates/fuel-core/src/lib.rs index 4814b49d487..90a3ca1baca 100644 --- a/crates/fuel-core/src/lib.rs +++ b/crates/fuel-core/src/lib.rs @@ -1,4 +1,5 @@ #![deny(unused_crate_dependencies)] +#![deny(warnings)] #[doc(no_inline)] pub use fuel_core_chain_config as chain_config; diff --git a/crates/fuel-core/src/service/adapters/block_importer.rs b/crates/fuel-core/src/service/adapters/block_importer.rs index 706a71460b5..53347208aea 100644 --- a/crates/fuel-core/src/service/adapters/block_importer.rs +++ b/crates/fuel-core/src/service/adapters/block_importer.rs @@ -84,14 +84,14 @@ impl RelayerPort for MaybeRelayerAdapter { async fn await_until_if_in_range( &self, da_height: &DaBlockHeight, - max_da_lag: &DaBlockHeight, + _max_da_lag: &DaBlockHeight, ) -> anyhow::Result<()> { #[cfg(feature = "relayer")] { if let Some(sync) = self.relayer_synced.as_ref() { let current_height = sync.get_finalized_da_height()?; anyhow::ensure!( - da_height.saturating_sub(*current_height) <= **max_da_lag, + da_height.saturating_sub(*current_height) <= **_max_da_lag, "Relayer is too far out of sync" ); sync.await_at_least_synced(da_height).await?; @@ -100,7 +100,6 @@ impl RelayerPort for MaybeRelayerAdapter { } #[cfg(not(feature = "relayer"))] { - core::mem::drop(max_da_lag); anyhow::ensure!( **da_height == 0, "Cannot have a da height above zero without a relayer" diff --git a/crates/metrics/src/lib.rs b/crates/metrics/src/lib.rs index 186106f320a..0774304d664 100644 --- a/crates/metrics/src/lib.rs +++ b/crates/metrics/src/lib.rs @@ -1,4 +1,5 @@ #![deny(unused_crate_dependencies)] +#![deny(warnings)] pub mod core_metrics; pub mod graphql_metrics; diff --git a/crates/services/consensus_module/bft/src/lib.rs b/crates/services/consensus_module/bft/src/lib.rs index 456016fb48f..d6712385398 100644 --- a/crates/services/consensus_module/bft/src/lib.rs +++ b/crates/services/consensus_module/bft/src/lib.rs @@ -1,4 +1,5 @@ #![deny(unused_crate_dependencies)] +#![deny(warnings)] pub mod config; pub mod service; diff --git a/crates/services/consensus_module/poa/src/lib.rs b/crates/services/consensus_module/poa/src/lib.rs index 5fd3256d594..c96bfd5b8d3 100644 --- a/crates/services/consensus_module/poa/src/lib.rs +++ b/crates/services/consensus_module/poa/src/lib.rs @@ -1,5 +1,6 @@ #![deny(unused_crate_dependencies)] #![deny(unused_must_use)] +#![deny(warnings)] mod deadline_clock; mod sync; diff --git a/crates/services/consensus_module/src/lib.rs b/crates/services/consensus_module/src/lib.rs index ef91482d8a9..9b07d1eea65 100644 --- a/crates/services/consensus_module/src/lib.rs +++ b/crates/services/consensus_module/src/lib.rs @@ -1,6 +1,7 @@ //! Common traits and logic for managing the lifecycle of services #![deny(unused_crate_dependencies)] #![deny(missing_docs)] +#![deny(warnings)] extern crate core; diff --git a/crates/services/executor/src/lib.rs b/crates/services/executor/src/lib.rs index b668684f6be..76935c8cd4b 100644 --- a/crates/services/executor/src/lib.rs +++ b/crates/services/executor/src/lib.rs @@ -1,4 +1,5 @@ #![deny(unused_crate_dependencies)] +#![deny(warnings)] mod config; diff --git a/crates/services/importer/src/lib.rs b/crates/services/importer/src/lib.rs index 43cb33906b4..33ed8721855 100644 --- a/crates/services/importer/src/lib.rs +++ b/crates/services/importer/src/lib.rs @@ -1,4 +1,5 @@ #![deny(unused_crate_dependencies)] +#![deny(warnings)] pub mod config; pub mod importer; diff --git a/crates/services/producer/src/lib.rs b/crates/services/producer/src/lib.rs index 5ec85d2bc89..08e55542ca1 100644 --- a/crates/services/producer/src/lib.rs +++ b/crates/services/producer/src/lib.rs @@ -1,5 +1,6 @@ #![deny(unused_crate_dependencies)] #![deny(unused_must_use)] +#![deny(warnings)] pub mod block_producer; pub mod config; diff --git a/crates/services/relayer/src/lib.rs b/crates/services/relayer/src/lib.rs index 0c170779eaf..dd88f18b54f 100644 --- a/crates/services/relayer/src/lib.rs +++ b/crates/services/relayer/src/lib.rs @@ -3,6 +3,7 @@ #![deny(unused_crate_dependencies)] #![forbid(unsafe_code)] #![deny(missing_docs)] +#![deny(warnings)] pub(crate) mod abi; pub(crate) mod config; diff --git a/crates/services/src/lib.rs b/crates/services/src/lib.rs index d1077e65a64..ae7adf22356 100644 --- a/crates/services/src/lib.rs +++ b/crates/services/src/lib.rs @@ -1,6 +1,7 @@ //! Common traits and logic for managing the lifecycle of services #![deny(unused_crate_dependencies)] #![deny(missing_docs)] +#![deny(warnings)] mod service; mod state; diff --git a/crates/services/sync/src/lib.rs b/crates/services/sync/src/lib.rs index f9c0318e015..8ff9cab3ca4 100644 --- a/crates/services/sync/src/lib.rs +++ b/crates/services/sync/src/lib.rs @@ -1,5 +1,6 @@ #![deny(unused_crate_dependencies)] #![deny(missing_docs)] +#![deny(warnings)] //! # Sync Service //! Responsible for syncing the blockchain from the network. diff --git a/crates/services/txpool/src/lib.rs b/crates/services/txpool/src/lib.rs index abf5d7a09fb..d966e323f81 100644 --- a/crates/services/txpool/src/lib.rs +++ b/crates/services/txpool/src/lib.rs @@ -1,4 +1,5 @@ #![deny(unused_crate_dependencies)] +#![deny(warnings)] use fuel_core_types::{ services::txpool::{ diff --git a/crates/storage/src/lib.rs b/crates/storage/src/lib.rs index 146ad03efff..b7a86f6c164 100644 --- a/crates/storage/src/lib.rs +++ b/crates/storage/src/lib.rs @@ -6,6 +6,7 @@ #![deny(unused_crate_dependencies)] #![deny(missing_docs)] +#![deny(warnings)] use fuel_core_types::services::executor::Error as ExecutorError; use std::io::ErrorKind; diff --git a/crates/types/src/lib.rs b/crates/types/src/lib.rs index 4e0047a59c8..e9715c5e696 100644 --- a/crates/types/src/lib.rs +++ b/crates/types/src/lib.rs @@ -4,6 +4,7 @@ #![deny(unused_crate_dependencies)] #![deny(missing_docs)] +#![deny(warnings)] #[doc(no_inline)] pub use fuel_vm_private::{ diff --git a/xtask/src/main.rs b/xtask/src/main.rs index aed736dd444..ea5b21572cd 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -1,4 +1,5 @@ #![deny(unused_crate_dependencies)] +#![deny(warnings)] use clap::Parser; use commands::{