Add destructure_struct_binding action

Separate into create and apply edit

Rename usages

Hacky name map

Add more tests

Handle non-exhaustive

Add some more TODOs

Private fields

Use todo

Nesting

Improve rest token generation

Cleanup

Doc -> regular comment

Support mut
This commit is contained in:
Niklas Lindorfer 2024-02-19 11:47:33 +00:00
parent 0ac05c0527
commit ed230048dc
No known key found for this signature in database
GPG key ID: D19D86B8C7F455A8
6 changed files with 647 additions and 3 deletions

View file

@ -656,6 +656,10 @@ pub fn wildcard_pat() -> ast::WildcardPat {
}
}
pub fn rest_pat() -> ast::RestPat {
ast_from_text("fn f(..)")
}
pub fn literal_pat(lit: &str) -> ast::LiteralPat {
return from_text(lit);
@ -716,8 +720,12 @@ pub fn record_pat_with_fields(path: ast::Path, fields: ast::RecordPatFieldList)
pub fn record_pat_field_list(
fields: impl IntoIterator<Item = ast::RecordPatField>,
rest_pat: Option<ast::RestPat>,
) -> ast::RecordPatFieldList {
let fields = fields.into_iter().join(", ");
let mut fields = fields.into_iter().join(", ");
if let Some(rest_pat) = rest_pat {
format_to!(fields, ", {rest_pat}");
}
ast_from_text(&format!("fn f(S {{ {fields} }}: ()))"))
}