Skip to content

Commit

Permalink
Auto merge of #16264 - roife:refactor/refactor-generate-delegate-trai…
Browse files Browse the repository at this point in the history
…t, r=Veykril

internal: clean and enhance readability for `generate_delegate_trait`

Continue from #16112

This PR primarily involves some cleanup and simple refactoring work, including:

- Adding numerous comments to layer the code and explain the behavior of each step.
- Renaming some variables to make them more sensible.
- Simplify certain operations using a more elegant approach.

The goal is to make this intricate implementation clearer and facilitate future maintenance.

In addition to this, the PR also removes redundant `path_transform` operations for `type_gen_args`.
Taking the example of `impl Trait<T1> for S<S1>`, where `S1` is considered. The struct `S` must be in the file where the user triggers code actions, so there's no need for the `path_transform`. Furthermore, before performing the transform, we've already renamed `S1`, ensuring it won't clash with existing generics parameters. Therefore, there's no need to transform it.
  • Loading branch information
bors committed Jan 5, 2024
2 parents 5945709 + fbdc59c commit 2271b82
Show file tree
Hide file tree
Showing 3 changed files with 141 additions and 193 deletions.

0 comments on commit 2271b82

Please sign in to comment.