Skip to content

#[tracing::instrument] swallows lints such as dead_code #1366

@andrewhickman

Description

@andrewhickman

Bug Report

Version

0.1.25

Platform

Windows 10 64-bit

Crates

  • tracing

Description

Functions wrapped in #[tracing::instrument] will not trigger lints such as dead_code. See andrewhickman/fn-error-context#3 for a very similar issue (in a much simpler macro) which was caused by dropping some spans on the macro tokens.

Minimal example to reproduce:

#[tracing::instrument]
fn never_used() {}

fn main() {}

Without the instrument attribute, we get a dead_code lint warning, but with it applied the warning is suppressed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions