Collect code coverage
Diff
.github/workflows/coverage.yml | 26 ++++++++++++++++++++++++++
src/util.rs | 10 +++++++++-
2 files changed, 35 insertions(+), 1 deletion(-)
@@ -0,0 +1,26 @@
on: [ push, pull_request ]
name: Test coverage
jobs:
coverage:
name: Collect test coverage
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: Install latest nextest release
uses: taiki-e/install-action@nextest
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Collect coverage data
run: cargo llvm-cov nextest --lcov --output-path lcov.info
- name: Upload coverage data to codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: lcov.info
@@ -1,16 +1,24 @@
use std::hash::Hasher;
use std::{
borrow::Cow,
fmt::{Display, Formatter},
hash::Hash,
ops::Deref,
sync::Arc,
};
#[derive(Debug, Hash, Eq)]
#[derive(Debug, Eq)]
pub enum ArcOrCowStr {
Arc(Arc<str>),
Cow(Cow<'static, str>),
}
impl Hash for ArcOrCowStr {
fn hash<H: Hasher>(&self, state: &mut H) {
(**self).hash(state);
}
}
impl PartialEq<ArcOrCowStr> for ArcOrCowStr {
fn eq(&self, other: &ArcOrCowStr) -> bool {
**self == **other