-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
skip needless_lifetimes inside macros (needs test!) #5283
Comments
Hmm, actually the lint should be skipped in external macros but not in local ones...? if in_external_macro(cx.sess(), span) || has_where_lifetimes(cx, &generics.where_clause) {
return;
} /~https://github.com/rust-lang/rust-clippy/blob/master/clippy_lints/src/lifetimes.rs#L129 |
don't emit lifetime lint warnings for code inside macros. Fixes #5283 changelog: Don't emit lifetime lint warnings for code inside macros.
Reopened as this still needs a testcase (see #5293 (comment)) |
@rustbot claim @matthiaskrgr I created a PR to add a test for this. I see your comment above about external macros, but I need to figure out how to test that. Do you mean a macro defined in a different crate? Similarly, I have this PR, which could use something defined in a separate crate for testing, and I am unsure how to achieve that. Are there any example tests in Clippy that define symbols in external crates? |
@matthiaskrgr I updated the PR to lint local macros and test for local and external macro expansion with needless lifetimes. |
I came across this example
and I'm wondering if the lint should skip macros.
The text was updated successfully, but these errors were encountered: