instrument annotation prevents clippy::print_stderr and clippy::print_stdout from working
Author: ZeroStrideCreated Aug 13, 2026Updated Aug 13, 2026
Bug Report
When #[instrument] is applied to a function, clippy no longer picks up uses of eprintln!, eprint!, println!, print! when linting for clippy::print_stderr or clippy::print_stdout, respectively.
The workaround I am using is to do #[cfg_attr(not(clippy), instrument)], however this is not ideal.
In this Rust Playground pick Tools > Clippy for an example of the bug, and the workaround.
Source: tokio-rs/tracing