Skip to content

Commit

Permalink
refactor: use workspace lint rules for active crates (#776)
Browse files Browse the repository at this point in the history
Signed-off-by: MrCroxx <mrcroxx@outlook.com>
  • Loading branch information
MrCroxx authored Oct 18, 2024
1 parent 388bcab commit 2b841e5
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 15 deletions.
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
3 changes: 3 additions & 0 deletions foyer-bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 3 additions & 1 deletion foyer-bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions foyer-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ thiserror = "1"
[[bin]]
name = "foyer"
path = "src/main.rs"

[lints]
workspace = true
4 changes: 2 additions & 2 deletions foyer-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
Expand Down
3 changes: 0 additions & 3 deletions foyer-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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".
Expand Down
3 changes: 3 additions & 0 deletions foyer-intrusive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ itertools = { workspace = true }

[features]
strict_assertions = ["foyer-common/strict_assertions"]

[lints]
workspace = true
2 changes: 0 additions & 2 deletions foyer-intrusive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
3 changes: 3 additions & 0 deletions foyer-memory/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,6 @@ harness = false
[[bench]]
name = "bench_dynamic_dispatch"
harness = false

[lints]
workspace = true
2 changes: 2 additions & 0 deletions foyer-memory/benches/bench_dynamic_dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
2 changes: 2 additions & 0 deletions foyer-memory/benches/bench_hit_ratio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 0 additions & 3 deletions foyer-memory/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions foyer-storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions foyer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@ tracing = [
"foyer-memory/tracing",
"foyer-storage/tracing",
]

[lints]
workspace = true
2 changes: 0 additions & 2 deletions foyer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//!
Expand Down

0 comments on commit 2b841e5

Please sign in to comment.