mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
implement fill match arm assist for tuple of enums
This commit is contained in:
parent
baa11d52f4
commit
2afccbe477
4 changed files with 160 additions and 14 deletions
|
@ -136,6 +136,15 @@ pub fn placeholder_pat() -> ast::PlaceholderPat {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn tuple_pat(pats: impl IntoIterator<Item = ast::Pat>) -> ast::TuplePat {
|
||||
let pats_str = pats.into_iter().map(|p| p.syntax().to_string()).join(", ");
|
||||
return from_text(&format!("({})", pats_str));
|
||||
|
||||
fn from_text(text: &str) -> ast::TuplePat {
|
||||
ast_from_text(&format!("fn f({}: ())", text))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn tuple_struct_pat(
|
||||
path: ast::Path,
|
||||
pats: impl IntoIterator<Item = ast::Pat>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue