Closed ijackson closed 1 month ago
Seems like the same as #79542. I would argue this isn't really a false positive. You can import for rustdoc only by adding a #[cfg(doc)]
to the import which resolves the warning.
Closing as this is a "true" positive in the sense that rustc cannot know that the imports are used by doc comments via rustdoc. #[cfg(doc)]
is one possible way to handle this. This also isn't actionable in the general case because rustc can't pull in rustdoc machinery to handle the doc usages.
Steps
Current output
Desired output
No warning
Rationale and extra context
use
on the name of a macro_rules macro is useful to give the macro path scope. In this case, the macro ends up being used by a rustdoc.Other cases
To show that the warning is incorrect:
which produces
Rust Version
Anything else?
clippy also complains about this; see https://github.com/rust-lang/rust-clippy/issues/13419