Description
From #48385
Many of our lints trigger even when the code is within a macro defined by an external crate. They should include macro checks.
Clippy has a function for this already.
We should include this in librustc::lint somewhere, and use it for various lints. It should not be used for future compat lints.
One possible thing to do here is to work it into the lint framework itself, so that non-future-compat lints which are triggered on macro spans will not actually be emitted.
We should still have the helper function since some lints may involve multiple important spans so they need the ability to check them all.
Ideally there would be a way to turn this off, though -- in case you want to find issues in your macros. It's a tricky problem.
Willing to mentor the basic issue of importing the macro checks and applying them in most lints (or working it into the framework).