From c1109bd9c478094b786efe4f36e848bb1d468757 Mon Sep 17 00:00:00 2001 From: rakita Date: Wed, 8 May 2024 01:09:15 +0200 Subject: [PATCH] chore: refactor lints (#1386) * chore: refactor lints * rustdoc lints * fix doc link --- crates/interpreter/Cargo.toml | 8 ++++++++ crates/interpreter/src/lib.rs | 4 +--- crates/precompile/Cargo.toml | 8 ++++++++ crates/precompile/src/lib.rs | 2 -- crates/primitives/Cargo.toml | 11 ++++++++--- crates/primitives/src/lib.rs | 4 +--- crates/revm/Cargo.toml | 18 +++++++++++++++--- crates/revm/src/journaled_state.rs | 2 +- crates/revm/src/lib.rs | 5 +---- 9 files changed, 43 insertions(+), 19 deletions(-) diff --git a/crates/interpreter/Cargo.toml b/crates/interpreter/Cargo.toml index 1b59e7d33a..db705bd976 100644 --- a/crates/interpreter/Cargo.toml +++ b/crates/interpreter/Cargo.toml @@ -13,6 +13,14 @@ readme = "../../README.md" all-features = true rustdoc-args = ["--cfg", "docsrs"] +[lints.rust] +unreachable_pub = "warn" +unused_must_use = "deny" +rust_2018_idioms = "deny" + +[lints.rustdoc] +all = "warn" + [dependencies] revm-primitives = { path = "../primitives", version = "3.1.1", default-features = false } diff --git a/crates/interpreter/src/lib.rs b/crates/interpreter/src/lib.rs index 27df443bd4..01db032788 100644 --- a/crates/interpreter/src/lib.rs +++ b/crates/interpreter/src/lib.rs @@ -1,9 +1,7 @@ //! # revm-interpreter //! //! REVM Interpreter. -#![warn(rustdoc::all)] -#![warn(unreachable_pub, unused_crate_dependencies)] -#![deny(unused_must_use, rust_2018_idioms)] +#![cfg_attr(not(test), warn(unused_crate_dependencies))] #![cfg_attr(not(feature = "std"), no_std)] #[cfg(not(feature = "std"))] diff --git a/crates/precompile/Cargo.toml b/crates/precompile/Cargo.toml index a9893a824d..8c7c7e6fcb 100644 --- a/crates/precompile/Cargo.toml +++ b/crates/precompile/Cargo.toml @@ -12,6 +12,14 @@ version = "6.0.0" all-features = true rustdoc-args = ["--cfg", "docsrs"] +[lints.rust] +unreachable_pub = "warn" +unused_must_use = "deny" +rust_2018_idioms = "deny" + +[lints.rustdoc] +all = "warn" + [dependencies] revm-primitives = { path = "../primitives", version = "3.1.1", default-features = false } bn = { package = "substrate-bn", version = "0.6", default-features = false } diff --git a/crates/precompile/src/lib.rs b/crates/precompile/src/lib.rs index aa3ffadfb1..4dc6cae518 100644 --- a/crates/precompile/src/lib.rs +++ b/crates/precompile/src/lib.rs @@ -1,9 +1,7 @@ //! # revm-precompile //! //! Implementations of EVM precompiled contracts. -#![warn(rustdoc::all)] #![cfg_attr(not(test), warn(unused_crate_dependencies))] -#![deny(unused_must_use, rust_2018_idioms)] #![cfg_attr(not(feature = "std"), no_std)] #[macro_use] diff --git a/crates/primitives/Cargo.toml b/crates/primitives/Cargo.toml index 32ab4efb40..07b049a0e7 100644 --- a/crates/primitives/Cargo.toml +++ b/crates/primitives/Cargo.toml @@ -9,13 +9,18 @@ repository = "https://github.com/bluealloy/revm" version = "3.1.1" readme = "../../README.md" -# Don't need to run build script outside of this repo -exclude = ["build.rs", "src/kzg/*.txt"] - [package.metadata.docs.rs] all-features = true rustdoc-args = ["--cfg", "docsrs"] +[lints.rust] +unreachable_pub = "warn" +unused_must_use = "deny" +rust_2018_idioms = "deny" + +[lints.rustdoc] +all = "warn" + [dependencies] alloy-primitives = { version = "0.7.2", default-features = false, features = [ "rlp", diff --git a/crates/primitives/src/lib.rs b/crates/primitives/src/lib.rs index 2ce1a8e556..c57f900b90 100644 --- a/crates/primitives/src/lib.rs +++ b/crates/primitives/src/lib.rs @@ -1,9 +1,7 @@ //! # revm-primitives //! //! EVM primitive types. -#![warn(rustdoc::all)] -#![warn(unreachable_pub, unused_crate_dependencies)] -#![deny(unused_must_use, rust_2018_idioms)] +#![cfg_attr(not(test), warn(unused_crate_dependencies))] #![cfg_attr(not(feature = "std"), no_std)] #[cfg(not(feature = "std"))] diff --git a/crates/revm/Cargo.toml b/crates/revm/Cargo.toml index a10599acd8..7ddb717591 100644 --- a/crates/revm/Cargo.toml +++ b/crates/revm/Cargo.toml @@ -13,6 +13,14 @@ readme = "../../README.md" all-features = true rustdoc-args = ["--cfg", "docsrs"] +[lints.rust] +unreachable_pub = "warn" +unused_must_use = "deny" +rust_2018_idioms = "deny" + +[lints.rustdoc] +all = "warn" + [dependencies] # revm revm-interpreter = { path = "../interpreter", version = "4.0.0", default-features = false } @@ -46,16 +54,20 @@ alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy.git", rev = "44b8a6 alloy-transport = { git = "https://github.com/alloy-rs/alloy.git", rev = "44b8a6d", optional = true, default-features = false } [dev-dependencies] -alloy-sol-types = { version = "0.7.0", default-features = false, features = ["std"] } +alloy-sol-types = { version = "0.7.0", default-features = false, features = [ + "std", +] } ethers-contract = { version = "2.0.14", default-features = false } anyhow = "1.0.82" criterion = "0.5" indicatif = "0.17" reqwest = { version = "0.12" } -alloy-provider = { git = "https://github.com/alloy-rs/alloy.git", rev = "44b8a6d", default-features = false, features = ["reqwest"] } +alloy-provider = { git = "https://github.com/alloy-rs/alloy.git", rev = "44b8a6d", default-features = false, features = [ + "reqwest", +] } # needed for enabling TLS to use HTTPS connections when testing alloy DB -alloy-transport-http = { git = "https://github.com/alloy-rs/alloy.git" , rev = "44b8a6d" } +alloy-transport-http = { git = "https://github.com/alloy-rs/alloy.git", rev = "44b8a6d" } [features] default = ["std", "c-kzg", "secp256k1", "portable"] diff --git a/crates/revm/src/journaled_state.rs b/crates/revm/src/journaled_state.rs index 96a1c186c5..a233a78ca0 100644 --- a/crates/revm/src/journaled_state.rs +++ b/crates/revm/src/journaled_state.rs @@ -15,7 +15,7 @@ use std::vec::Vec; pub struct JournaledState { /// Current state. pub state: State, - /// [EIP-1153[(https://eips.ethereum.org/EIPS/eip-1153) transient storage that is discarded after every transactions + /// [EIP-1153](https://eips.ethereum.org/EIPS/eip-1153) transient storage that is discarded after every transactions pub transient_storage: TransientStorage, /// logs pub logs: Vec, diff --git a/crates/revm/src/lib.rs b/crates/revm/src/lib.rs index cf9b275a66..6b69b5bd2a 100644 --- a/crates/revm/src/lib.rs +++ b/crates/revm/src/lib.rs @@ -1,8 +1,5 @@ -#![doc = "Revm is a Rust EVM implementation."] -#![warn(rustdoc::all, unreachable_pub)] -#![allow(rustdoc::bare_urls)] +//! Revm is a Rust EVM implementation. #![cfg_attr(not(test), warn(unused_crate_dependencies))] -#![deny(unused_must_use, rust_2018_idioms)] #![cfg_attr(not(feature = "std"), no_std)] #[macro_use]