aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast/make.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/ast/make.rs')
-rw-r--r--crates/ra_syntax/src/ast/make.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs
index 9f6f1cc53..9d8ed6238 100644
--- a/crates/ra_syntax/src/ast/make.rs
+++ b/crates/ra_syntax/src/ast/make.rs
@@ -136,6 +136,15 @@ pub fn placeholder_pat() -> ast::PlaceholderPat {
136 } 136 }
137} 137}
138 138
139pub fn tuple_pat(pats: impl IntoIterator<Item = ast::Pat>) -> ast::TuplePat {
140 let pats_str = pats.into_iter().map(|p| p.syntax().to_string()).join(", ");
141 return from_text(&format!("({})", pats_str));
142
143 fn from_text(text: &str) -> ast::TuplePat {
144 ast_from_text(&format!("fn f({}: ())", text))
145 }
146}
147
139pub fn tuple_struct_pat( 148pub fn tuple_struct_pat(
140 path: ast::Path, 149 path: ast::Path,
141 pats: impl IntoIterator<Item = ast::Pat>, 150 pats: impl IntoIterator<Item = ast::Pat>,