Closed matthiaskrgr closed 1 year ago
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
Reopened as this still needs a testcase (see https://github.com/rust-lang/rust-clippy/pull/5293#issuecomment-606089488)
@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.