diff --git a/Cargo.toml b/Cargo.toml index b728a02c..954908aa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,7 +56,11 @@ foyer-storage = { version = "0.12.2", path = "foyer-storage" } foyer = { version = "0.12.2", path = "foyer" } [workspace.lints.rust] +missing_docs = "warn" unexpected_cfgs = { level = "warn", check-cfg = ['cfg(madsim)'] } +[workspace.lints.clippy] +allow_attributes = "warn" + [profile.release] debug = "full" diff --git a/foyer-bench/Cargo.toml b/foyer-bench/Cargo.toml index 966c2e91..be44aba6 100644 --- a/foyer-bench/Cargo.toml +++ b/foyer-bench/Cargo.toml @@ -48,3 +48,6 @@ sanity = ["foyer/sanity"] jemalloc = ["dep:tikv-jemallocator"] jeprof = ["jemalloc", "tikv-jemallocator?/profiling"] tracing = ["foyer/tracing", "dep:fastrace-jaeger", "dep:fastrace"] + +[lints] +workspace = true diff --git a/foyer-bench/src/main.rs b/foyer-bench/src/main.rs index 148756e8..251084ae 100644 --- a/foyer-bench/src/main.rs +++ b/foyer-bench/src/main.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +//! foyer benchmark tools. + #![warn(clippy::allow_attributes)] mod analyze; @@ -60,7 +62,7 @@ static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; #[derive(Parser, Debug, Clone)] #[command(author, version, about)] #[command(group = ArgGroup::new("exclusive").required(true).args(&["file", "dir", "no_disk"]))] -pub struct Args { +struct Args { /// Run with in-memory cache compatible mode. /// /// One of `no_disk`, `file`, `dir` must be set. diff --git a/foyer-cli/Cargo.toml b/foyer-cli/Cargo.toml index 7112d357..ca230e84 100644 --- a/foyer-cli/Cargo.toml +++ b/foyer-cli/Cargo.toml @@ -24,3 +24,6 @@ thiserror = "1" [[bin]] name = "foyer" path = "src/main.rs" + +[lints] +workspace = true diff --git a/foyer-cli/src/main.rs b/foyer-cli/src/main.rs index 081289f8..d0a8a71b 100644 --- a/foyer-cli/src/main.rs +++ b/foyer-cli/src/main.rs @@ -21,13 +21,13 @@ use clap::{Parser, Subcommand}; #[derive(Debug, Parser)] #[command(author, version, about)] -pub struct Cli { +struct Cli { #[command(subcommand)] command: Command, } #[derive(Debug, Subcommand)] -pub enum Command { +enum Command { /// Automatic arguments detector. Args(ArgsArgs), } diff --git a/foyer-common/src/lib.rs b/foyer-common/src/lib.rs index bff5d147..98356144 100644 --- a/foyer-common/src/lib.rs +++ b/foyer-common/src/lib.rs @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![warn(missing_docs)] -#![warn(clippy::allow_attributes)] - //! Shared components and utils for foyer. /// Allow enable debug assertions in release profile with feature "strict_assertion". diff --git a/foyer-intrusive/Cargo.toml b/foyer-intrusive/Cargo.toml index 85ce93b5..6c6d0eff 100644 --- a/foyer-intrusive/Cargo.toml +++ b/foyer-intrusive/Cargo.toml @@ -18,3 +18,6 @@ itertools = { workspace = true } [features] strict_assertions = ["foyer-common/strict_assertions"] + +[lints] +workspace = true diff --git a/foyer-intrusive/src/lib.rs b/foyer-intrusive/src/lib.rs index 4ec6cca3..b176003e 100644 --- a/foyer-intrusive/src/lib.rs +++ b/foyer-intrusive/src/lib.rs @@ -13,8 +13,6 @@ // limitations under the License. #![expect(clippy::new_without_default)] -#![warn(missing_docs)] -#![warn(clippy::allow_attributes)] //! Intrusive data structures and utils for foyer. diff --git a/foyer-memory/Cargo.toml b/foyer-memory/Cargo.toml index 2d116f3a..eab9cc62 100644 --- a/foyer-memory/Cargo.toml +++ b/foyer-memory/Cargo.toml @@ -53,3 +53,6 @@ harness = false [[bench]] name = "bench_dynamic_dispatch" harness = false + +[lints] +workspace = true diff --git a/foyer-memory/benches/bench_dynamic_dispatch.rs b/foyer-memory/benches/bench_dynamic_dispatch.rs index 826643c5..3594effa 100644 --- a/foyer-memory/benches/bench_dynamic_dispatch.rs +++ b/foyer-memory/benches/bench_dynamic_dispatch.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +//! micro benchmark for dynamic dispatch + use std::{ sync::Arc, time::{Duration, Instant}, diff --git a/foyer-memory/benches/bench_hit_ratio.rs b/foyer-memory/benches/bench_hit_ratio.rs index be1fdb13..42dbfb38 100644 --- a/foyer-memory/benches/bench_hit_ratio.rs +++ b/foyer-memory/benches/bench_hit_ratio.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +//! micro benchmark for foyer in-memory cache hit ratio + use std::sync::Arc; use csv::Reader; diff --git a/foyer-memory/src/lib.rs b/foyer-memory/src/lib.rs index afcb3d14..b92cf831 100644 --- a/foyer-memory/src/lib.rs +++ b/foyer-memory/src/lib.rs @@ -62,9 +62,6 @@ //! The handle that does not appear in either the indexer or the eviction container, and has no external owner, will be //! destroyed. -#![warn(missing_docs)] -#![warn(clippy::allow_attributes)] - mod cache; mod context; mod eviction; diff --git a/foyer-storage/src/lib.rs b/foyer-storage/src/lib.rs index 7d5b2b6a..4d853fba 100644 --- a/foyer-storage/src/lib.rs +++ b/foyer-storage/src/lib.rs @@ -16,8 +16,6 @@ #![cfg_attr(feature = "nightly", feature(allocator_api))] #![cfg_attr(feature = "nightly", feature(write_all_vectored))] -#![warn(missing_docs)] -#![warn(clippy::allow_attributes)] mod compress; mod device; diff --git a/foyer/Cargo.toml b/foyer/Cargo.toml index 3352170b..2d932cae 100644 --- a/foyer/Cargo.toml +++ b/foyer/Cargo.toml @@ -45,3 +45,6 @@ tracing = [ "foyer-memory/tracing", "foyer-storage/tracing", ] + +[lints] +workspace = true diff --git a/foyer/src/lib.rs b/foyer/src/lib.rs index d116d7e1..ecc1a3d4 100644 --- a/foyer/src/lib.rs +++ b/foyer/src/lib.rs @@ -13,8 +13,6 @@ // limitations under the License. #![cfg_attr(feature = "nightly", feature(allocator_api))] -#![warn(missing_docs)] -#![warn(clippy::allow_attributes)] //! A hybrid cache library that supports plug-and-play cache algorithms, in-memory cache and disk cache. //!