Skip to content

Commit

Permalink
chore: make clippy happy with rust 1.83.0 (#807)
Browse files Browse the repository at this point in the history
* chore: make clippy happy with rust 1.83.0

Signed-off-by: MrCroxx <[email protected]>

* test: enable clippy check only with stable toolchain

Signed-off-by: MrCroxx <[email protected]>

---------

Signed-off-by: MrCroxx <[email protected]>
  • Loading branch information
MrCroxx authored Nov 28, 2024
1 parent 9d56852 commit 746333e
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 62 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust_toolchain: [stable, 1.82.0]
rust_toolchain: [stable, 1.81.0]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
Expand Down Expand Up @@ -160,7 +160,8 @@ jobs:
- name: Run rust format check
run: |
cargo fmt --all -- --check
- name: Run rust clippy check
- name: Run rust clippy check (stable)
if: matrix.rust_toolchain == 'stable'
run: |
cargo clippy --all-targets --features tokio-console -- -D warnings
cargo clippy --all-targets --features deadlock -- -D warnings
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ members = [
[workspace.package]
version = "0.13.0-dev"
edition = "2021"
rust-version = "1.82.0"
rust-version = "1.81.0"
repository = "https://github.com/foyer-rs/foyer"
homepage = "https://foyer.rs"
keywords = ["cache", "hybrid"]
Expand Down
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ fast: check test example
msrv:
shellcheck ./scripts/*
./scripts/minimize-dashboards.sh
cargo +1.82.0 sort -w
cargo +1.82.0 fmt --all
cargo +1.82.0 clippy --all-targets --features deadlock
cargo +1.82.0 clippy --all-targets --features tokio-console
cargo +1.82.0 clippy --all-targets
RUST_BACKTRACE=1 cargo +1.82.0 nextest run --all
RUST_BACKTRACE=1 cargo +1.82.0 test --doc
RUST_BACKTRACE=1 cargo +1.82.0 nextest run --run-ignored ignored-only --no-capture --workspace
cargo +1.81.0 sort -w
cargo +1.81.0 fmt --all
cargo +1.81.0 clippy --all-targets --features deadlock
cargo +1.81.0 clippy --all-targets --features tokio-console
cargo +1.81.0 clippy --all-targets
RUST_BACKTRACE=1 cargo +1.81.0 nextest run --all
RUST_BACKTRACE=1 cargo +1.81.0 test --doc
RUST_BACKTRACE=1 cargo +1.81.0 nextest run --run-ignored ignored-only --no-capture --workspace

udeps:
RUSTFLAGS="--cfg tokio_unstable -Awarnings" cargo +nightly-2024-08-30 udeps --all-targets
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ async fn main() -> Result<()> {
.with_eviction_config(LruConfig {
high_priority_pool_ratio: 0.1,
})
.with_object_pool_capacity(1024)
.with_hash_builder(ahash::RandomState::default())
.with_weighter(|_key, value: &String| value.len())
.storage(Engine::Mixed(0.1))
Expand Down Expand Up @@ -223,7 +222,7 @@ More examples and details can be found [here](https://github.com/foyer-rs/foyer/

## Supported Rust Versions

*foyer* is built against the recent stable release. The minimum supported version is 1.82.0. The current *foyer* version is not guaranteed to build on Rust versions earlier than the minimum supported version.
*foyer* is built against the recent stable release. The minimum supported version is 1.81.0. The current *foyer* version is not guaranteed to build on Rust versions earlier than the minimum supported version.

## Supported Platforms

Expand Down
49 changes: 1 addition & 48 deletions foyer-common/src/metrics/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,115 +25,68 @@ trait Boxer {
}
impl<T> Boxer for T {}

// FIXME: https://github.com/rust-lang/rust-analyzer/issues/17685
// #[expect(missing_docs)]
/// ... ...
#[expect(missing_docs)]
#[derive(Debug)]
pub struct Metrics {
/* in-memory cache metrics */
/// ... ...
pub memory_insert: BoxedCounter,
/// ... ...
pub memory_replace: BoxedCounter,
/// ... ...
pub memory_hit: BoxedCounter,
/// ... ...
pub memory_miss: BoxedCounter,
/// ... ...
pub memory_remove: BoxedCounter,
/// ... ...
pub memory_evict: BoxedCounter,
/// ... ...
pub memory_reinsert: BoxedCounter,
/// ... ...
pub memory_release: BoxedCounter,
/// ... ...
pub memory_queue: BoxedCounter,
/// ... ...
pub memory_fetch: BoxedCounter,

/// ... ...
pub memory_usage: BoxedGauge,

/* disk cache metrics */
/// ... ...
pub storage_enqueue: BoxedCounter,
/// ... ...
pub storage_hit: BoxedCounter,
/// ... ...
pub storage_miss: BoxedCounter,
/// ... ...
pub storage_delete: BoxedCounter,

/// ... ...
pub storage_enqueue_duration: BoxedHistogram,
/// ... ...
pub storage_hit_duration: BoxedHistogram,
/// ... ...
pub storage_miss_duration: BoxedHistogram,
/// ... ...
pub storage_delete_duration: BoxedHistogram,

/// ... ...
pub storage_queue_rotate: BoxedCounter,
/// ... ...
pub storage_queue_rotate_duration: BoxedHistogram,
/// ... ...
pub storage_queue_drop: BoxedCounter,

/// ... ...
pub storage_disk_write: BoxedCounter,
/// ... ...
pub storage_disk_read: BoxedCounter,
/// ... ...
pub storage_disk_flush: BoxedCounter,

/// ... ...
pub storage_disk_write_bytes: BoxedCounter,
/// ... ...
pub storage_disk_read_bytes: BoxedCounter,

/// ... ...
pub storage_disk_write_duration: BoxedHistogram,
/// ... ...
pub storage_disk_read_duration: BoxedHistogram,
/// ... ...
pub storage_disk_flush_duration: BoxedHistogram,

/// ... ...
pub storage_region_total: BoxedGauge,
/// ... ...
pub storage_region_clean: BoxedGauge,
/// ... ...
pub storage_region_evictable: BoxedGauge,

/// ... ...
pub storage_region_size_bytes: BoxedGauge,

/// ... ...
pub storage_entry_serialize_duration: BoxedHistogram,
/// ... ...
pub storage_entry_deserialize_duration: BoxedHistogram,

/* hybrid cache metrics */
/// ... ...
pub hybrid_insert: BoxedCounter,
/// ... ...
pub hybrid_hit: BoxedCounter,
/// ... ...
pub hybrid_miss: BoxedCounter,
/// ... ...
pub hybrid_remove: BoxedCounter,

/// ... ...
pub hybrid_insert_duration: BoxedHistogram,
/// ... ...
pub hybrid_hit_duration: BoxedHistogram,
/// ... ...
pub hybrid_miss_duration: BoxedHistogram,
/// ... ...
pub hybrid_remove_duration: BoxedHistogram,
/// ... ...
pub hybrid_fetch_duration: BoxedHistogram,
}

Expand Down
2 changes: 1 addition & 1 deletion foyer-storage/src/small/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ pub struct SetEntry<'a> {
pub value: &'a [u8],
}

impl<'a> SetEntry<'a> {
impl SetEntry<'_> {
/// Length of the entry with header, key and value included.
pub fn len(&self) -> usize {
EntryHeader::ENTRY_HEADER_SIZE + self.key.len() + self.value.len()
Expand Down
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.

//! Fuzzy test for foyer storage engines.
#![expect(clippy::identity_op)]

use std::{path::Path, sync::Arc, time::Duration};
Expand Down

0 comments on commit 746333e

Please sign in to comment.