moka-rs / moka

A high performance concurrent caching library for Rust
Apache License 2.0
1.63k stars 73 forks source link

Make `once_cell` dependency optional #444

Closed tatsuya6502 closed 4 months ago

tatsuya6502 commented 4 months ago

Fixes #427.

This pull request changes once_cell crate optional. After applying this change, once_cell is used by moka only when the followings:

## `once_cell` is used in [dev-dependency], and indirectly via `quanta`.

$ cargo tree -i once_cell -F future,sync
once_cell v1.19.0
├── ahash v0.8.11
│   [dev-dependencies]
│   └── moka v0.12.8 ( ... /moka)
├── async-global-executor v2.4.1
│   └── async-std v1.12.0
│       [dev-dependencies]
│       └── moka v0.12.8 ( ... /moka)
├── async-std v1.12.0 (*)
├── quanta v0.12.3
│   └── moka v0.12.8 ( ... /moka)
├── reqwest v0.11.27
│   [dev-dependencies]
│   └── moka v0.12.8 ( ... /moka)
└── tracing-core v0.1.32
    └── tracing v0.1.40
        ├── async-io v2.3.3
        │   └── async-global-executor v2.4.1 (*)
        ├── h2 v0.3.26
        │   ├── hyper v0.14.30
        │   │   ├── hyper-rustls v0.24.2
        │   │   │   └── reqwest v0.11.27 (*)
        │   │   └── reqwest v0.11.27 (*)
        │   └── reqwest v0.11.27 (*)
        ├── hyper v0.14.30 (*)
        └── polling v3.7.2
            └── async-io v2.3.3 (*)
[dev-dependencies]
└── moka v0.12.8 ( ... /moka)

## If the default features is disabled, `once_cell` appears only under [dev-dependency].

cargo tree -i once_cell --no-default-features -F future,sync
once_cell v1.19.0
├── ahash v0.8.11
│   [dev-dependencies]
│   └── moka v0.12.8 ( ... /moka)
├── async-global-executor v2.4.1
│   └── async-std v1.12.0
│       [dev-dependencies]
│       └── moka v0.12.8 ( ... /moka)
├── async-std v1.12.0 (*)
├── reqwest v0.11.27
│   [dev-dependencies]
│   └── moka v0.12.8 ( ... /moka)
└── tracing-core v0.1.32
    └── tracing v0.1.40
        ├── async-io v2.3.3
        │   └── async-global-executor v2.4.1 (*)
        ├── h2 v0.3.26
        │   ├── hyper v0.14.30
        │   │   ├── hyper-rustls v0.24.2
        │   │   │   └── reqwest v0.11.27 (*)
        │   │   └── reqwest v0.11.27 (*)
        │   └── reqwest v0.11.27 (*)
        ├── hyper v0.14.30 (*)
        └── polling v3.7.2
            └── async-io v2.3.3 (*)
[dev-dependencies]
└── moka v0.12.8 ( ... /moka)
codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 95.04%. Comparing base (1636ed9) to head (19abacf). Report is 2 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #444 +/- ## ========================================== + Coverage 95.00% 95.04% +0.03% ========================================== Files 44 44 Lines 20979 20979 ========================================== + Hits 19932 19939 +7 + Misses 1047 1040 -7 ```