Skip to content

Disable coverage for derived traits #222

@zbraniecki

Description

@zbraniecki

In a library I work on, we add Derive traits on public structs so that our clients can use them, we fairly often don't need them in our internal work, and we don't want to keep adding tests just to verify that default trait works.

The result is that a lot of our coverage for code like this:

#[derive(Debug, PartialEq, Eq, Clone, Hash, PartialOrd, Ord, Copy)]
#[non_exhaustive]
pub enum ExtensionType {
    /// Transform Extension Type marked as `t`.
    Transform,
    /// Unicode Extension Type marked as `u`.
    Unicode,
    /// Private Extension Type marked as `x`.
    Private,
    /// All other extension types.
    Other(u8),
}

gets flagged with:

Unexecuted instantiation: <icu_locid::extensions::ExtensionType as core::fmt::Debug>::fmt
Unexecuted instantiation: <icu_locid::extensions::ExtensionType as core::fmt::Debug>::fmt
Unexecuted instantiation: <icu_locid::extensions::ExtensionType as core::cmp::PartialEq>::eq
Unexecuted instantiation: <icu_locid::extensions::ExtensionType as core::cmp::PartialEq>::eq
Unexecuted instantiation: <icu_locid::extensions::ExtensionType as core::clone::Clone>::clone
Unexecuted instantiation: <icu_locid::extensions::ExtensionType as core::clone::Clone>::clone
Unexecuted instantiation: <icu_locid::extensions::ExtensionType as core::hash::Hash>::hash::<>
Unexecuted instantiation: <icu_locid::extensions::ExtensionType as core::hash::Hash>::hash::<
>
Unexecuted instantiation: <icu_locid::extensions::ExtensionType as core::cmp::PartialOrd>::partial_cmp
Unexecuted instantiation: <icu_locid::extensions::ExtensionType as core::cmp::PartialOrd>::partial_cmp
Unexecuted instantiation: <icu_locid::extensions::ExtensionType as core::cmp::Ord>::cmp
Unexecuted instantiation: <icu_locid::extensions::ExtensionType as core::cmp::Ord>::cmp

which makes the coverage noisy and less useful to notice actual coverage gaps.

How can we disable coverage for default derived traits?

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-upstream-bugCategory: This is a bug of compiler or dependencies (the fix may require action in the upstream)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions