aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src
diff options
context:
space:
mode:
authorJosh Mcguigan <[email protected]>2020-03-23 12:19:09 +0000
committerJosh Mcguigan <[email protected]>2020-03-23 12:19:09 +0000
commitbc48c9d5116f08efea26da94c82a3eaa1622fc5d (patch)
treee6aa05f86105c475cd0e5da81647770bf68ecd9d /crates/ra_syntax/src
parent2afccbe47727d9d2787f76efd67f5b5d9ff1d55a (diff)
review comments
Diffstat (limited to 'crates/ra_syntax/src')
-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 {