Skip to content

Migrate inline_type_alias assist to use syntax_editor #20314

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

Conversation

Hmikihiro
Copy link
Contributor

part of #15710 and #18285

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 27, 2025
} else if let Some(name_ref) = ast::NameRef::cast(syntax.clone()) {
let Some(replacement_syntax) = const_and_type_map.0.get(&name_ref.to_string()) else {
continue;
};
let new_string = replacement_syntax.to_string();
let new = if new_string == "_" {
make::wildcard_pat().syntax().clone_for_update()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to replace this with

pub fn wildcard_pat(&self) -> ast::WildcardPat {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@ShoyuVanilla
Copy link
Member

One more thing here:

let wildcard_lifetime = make::lifetime("'_");
let lifetimes = alias_generics
.lifetime_params()
.filter_map(|lp| lp.lifetime())
.map(|l| l.to_string())
.collect_vec();

with

pub fn lifetime(&self, text: &str) -> ast::Lifetime {

and

pub fn lifetime_arg(&self, lifetime: ast::Lifetime) -> ast::LifetimeArg {

Everything else looks good to me!

Copy link
Member

@ShoyuVanilla ShoyuVanilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ShoyuVanilla ShoyuVanilla added this pull request to the merge queue Jul 30, 2025
Merged via the queue into rust-lang:master with commit 8611b71 Jul 30, 2025
15 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants