implement fill match arm assist for tuple of enums

This commit is contained in:
Josh Mcguigan 2020-03-22 22:42:32 -07:00
parent baa11d52f4
commit 2afccbe477
4 changed files with 160 additions and 14 deletions

View file

@ -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>,