In "Fill match arms", allow users to prefer Self to the enum name when possible

But default to not to.

I chose to have a more generic config name because maybe other assists could also use the same approach.
This commit is contained in:
Chayim Refael Friedman 2025-06-06 16:34:53 +03:00
parent 4fd1cdb3e3
commit 25a7b2480e
7 changed files with 227 additions and 29 deletions

View file

@ -134,6 +134,13 @@ pub fn name_ref(name_ref: &str) -> ast::NameRef {
}
}
}
pub fn name_ref_self_ty() -> ast::NameRef {
quote! {
NameRef {
[Self]
}
}
}
fn raw_ident_esc(ident: &str) -> &'static str {
if is_raw_identifier(ident, Edition::CURRENT) { "r#" } else { "" }
}