mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
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:
parent
0ac05c0527
commit
ed230048dc
6 changed files with 647 additions and 3 deletions
|
@ -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} }}: ()))"))
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue