-
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
Add utils helper for filtering out type/lifetime parameters on generics #3787
Comments
lol you read my mind. I was gonna add this to rustc directly, because they probably have the same problems. I think we can add this directly on the |
IIRC this used to exist on Generics anyway, but got removed at some point. I recall doing a rustup where we added a bunch of these matches. But sure, adding this to rustc would be great, I'm sure it has a similar pattern. |
I'm in favor of implementing such a function in rustc: rust-clippy/clippy_lints/src/methods/mod.rs Lines 2471 to 2480 in db13e6f
Git blame me: #2871 I'll open a PR in rustc in the next few days for these iterators. |
Just found a case in a PR to rustc: https://github.com/rust-lang/rust/pull/58583/files#diff-9d22f4d35c9bd98748f3e1a7cda1b3e7R694 |
See https://github.com/rust-lang/rust-clippy/pull/3786/files , we have a lot of code that does something like
params.args.iter().filter_map(|arg| match arg { GenericArg::Lifetime(lt) => Some(lt), _ => None }
We should probably have a helper function that returns an iterator for these, placed in
utils
. Probably something like:The text was updated successfully, but these errors were encountered: