Skip to content

internal: Migrate assists to the structured snippet API, part 6/7 #16467

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

Merged
merged 13 commits into from
Feb 9, 2024

Conversation

DropDemBits
Copy link
Contributor

Continuing from #16082

Migrates the following assists:

  • extract_function
  • generate_getter_or_setter
  • generate_impl
  • generate_new
  • replace_derive_with_manual_impl

Would've been the final PR in the structured snippet migration series, but I didn't notice that generate_trait_from_impl started to use {insert,replace}_snippet when I first started the migration 😅. This appears to be a pretty self-contained change, so I'll leave that for a separate future PR.

This also removes the last usages of render_snippet, which was a follow up goal of #11638. 🎉

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 1, 2024
@DropDemBits
Copy link
Contributor Author

Fixes #13558 too, since the structured snippet API always escapes existing backslashes and dollar signs in code.

@DropDemBits DropDemBits force-pushed the structured-snippet-migrate-6 branch from 26cdb10 to d6dd9eb Compare February 1, 2024 04:34
@Veykril
Copy link
Member

Veykril commented Feb 8, 2024

Thanks!
@bors r+

@bors
Copy link
Contributor

bors commented Feb 8, 2024

📌 Commit d6dd9eb has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Feb 8, 2024

⌛ Testing commit d6dd9eb with merge e007cdb...

bors added a commit that referenced this pull request Feb 8, 2024
…ykril

internal: Migrate assists to the structured snippet API, part 6/7

Continuing from #16082

Migrates the following assists:

- `extract_function`
- `generate_getter_or_setter`
- `generate_impl`
- `generate_new`
- `replace_derive_with_manual_impl`

Would've been the final PR in the structured snippet migration series, but I didn't notice that `generate_trait_from_impl` started to use `{insert,replace}_snippet` when I first started the migration 😅. This appears to be a pretty self-contained change, so I'll leave that for a separate future PR.

This also removes the last usages of `render_snippet`, which was a follow up goal of #11638. 🎉
@bors
Copy link
Contributor

bors commented Feb 8, 2024

💔 Test failed - checks-actions

@Veykril
Copy link
Member

Veykril commented Feb 8, 2024

Some clippy lints need fixing (we enabled clippy since)
@bors delegate+

@bors
Copy link
Contributor

bors commented Feb 8, 2024

✌️ @DropDemBits, you can now approve this pull request!

If @Veykril told you to "r=me" after making some further change, please make that change, then do @bors r=@Veykril

@bors
Copy link
Contributor

bors commented Feb 8, 2024

☔ The latest upstream changes (presumably #16477) made this pull request unmergeable. Please resolve the merge conflicts.

`make::impl_` no longer merges generic params and args in order to be in line
with `make::impl_`, which doesn't do it either.
Shortcut version of `make::expr_path(make::path_unqualified(make::path_segment_self()))`
Needed to recreate the behavior of `generate_new` addding the `new` method at the start of the impl
All usages of `render_snippet` and `Cursor` have been removed as part of the migration
@DropDemBits DropDemBits force-pushed the structured-snippet-migrate-6 branch from d6dd9eb to 11b075b Compare February 9, 2024 00:28
@DropDemBits DropDemBits force-pushed the structured-snippet-migrate-6 branch from 11b075b to 05b8ccc Compare February 9, 2024 00:39
@DropDemBits
Copy link
Contributor Author

@bors r+

@bors
Copy link
Contributor

bors commented Feb 9, 2024

📌 Commit 05b8ccc has been approved by DropDemBits

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Feb 9, 2024

⌛ Testing commit 05b8ccc with merge 57fda12...

@bors
Copy link
Contributor

bors commented Feb 9, 2024

☀️ Test successful - checks-actions
Approved by: DropDemBits
Pushing 57fda12 to master...

@bors bors merged commit 57fda12 into rust-lang:master Feb 9, 2024
@DropDemBits DropDemBits deleted the structured-snippet-migrate-6 branch February 9, 2024 17:47
bors added a commit that referenced this pull request Feb 16, 2024
…ykril

internal: Migrate assists to the structured snippet API, part 7/7

Continuing from #16467

Migrates the following assists:

- `generate_trait_from_impl`

This adds `add_placeholder_snippet_group`, which adds a group of placeholder snippets which are linked together and allows for renaming generated items without going through a separate rename step.

This also removes the last usages of `SourceChangeBuilder::{insert,replace}_snippet`, as all assists have finally been migrated to the structured snippet versions of those methods.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants