aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/src/ast/make.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs
index 9d8ed6238..9257ccd1a 100644
--- a/crates/ra_syntax/src/ast/make.rs
+++ b/crates/ra_syntax/src/ast/make.rs
@@ -136,8 +136,13 @@ pub fn placeholder_pat() -> ast::PlaceholderPat {
136 } 136 }
137} 137}
138 138
139/// Creates a tuple of patterns from an interator of patterns.
140///
141/// Invariant: `pats` must be length > 1
142///
143/// FIXME handle `pats` length == 1
139pub fn tuple_pat(pats: impl IntoIterator<Item = ast::Pat>) -> ast::TuplePat { 144pub 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(", "); 145 let pats_str = pats.into_iter().map(|p| p.to_string()).join(", ");
141 return from_text(&format!("({})", pats_str)); 146 return from_text(&format!("({})", pats_str));
142 147
143 fn from_text(text: &str) -> ast::TuplePat { 148 fn from_text(text: &str) -> ast::TuplePat {