diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3a6a5e2..a48224b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,6 +29,27 @@ jobs: - run: cargo check --all-targets --no-default-features --features sharded-lock - run: cargo check --all-targets --features shuttle + msrv: + name: MSRV + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - uses: taiki-e/install-action@v2 + with: + tool: cargo-msrv + # `cargo msrv verify` checks that the crate compiles with the + # `rust-version` declared in Cargo.toml. The default `cargo check` skips + # dev-dependencies, which may require a newer Rust than downstream needs. + - run: cargo msrv verify + - run: cargo msrv verify -- cargo check --features stats + - run: cargo msrv verify -- cargo check --no-default-features + - run: cargo msrv verify -- cargo check --no-default-features --features sharded-lock + test: name: Tests strategy: diff --git a/src/linked_slab.rs b/src/linked_slab.rs index bd840da..7a252c6 100644 --- a/src/linked_slab.rs +++ b/src/linked_slab.rs @@ -247,6 +247,6 @@ impl LinkedSlab { /// It should be noted that if cache key or value is some type like `Vec`, /// the memory allocated in the heap will not be counted. pub fn memory_used(&self) -> usize { - self.entries.len() * size_of::>() + self.entries.len() * std::mem::size_of::>() } }