rust-lang / rust-lang/rust-clippy

Add utils helper for filtering out type/lifetime parameters on generics

Open
#3,787 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-enhancement good first issue
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

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:

fn types_of_generics(generics: &Generics) -> impl Iterator<Type> {...}
fn lifetimes_of_generics(generics: &Generics) -> impl Iterator<Lifetime> {...}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the generic-argument filtering patterns shown in the files changed by pull request 3786, then inspect the existing utils module. Add the proposed helpers for extracting types and lifetimes from generics, and verify that their iterator behavior matches the existing filtering patterns.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.