From bc48c9d5116f08efea26da94c82a3eaa1622fc5d Mon Sep 17 00:00:00 2001 From: Josh Mcguigan Date: Mon, 23 Mar 2020 05:19:09 -0700 Subject: review comments --- crates/ra_syntax/src/ast/make.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'crates/ra_syntax/src/ast') 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 { } } +/// Creates a tuple of patterns from an interator of patterns. +/// +/// Invariant: `pats` must be length > 1 +/// +/// FIXME handle `pats` length == 1 pub fn tuple_pat(pats: impl IntoIterator) -> ast::TuplePat { - let pats_str = pats.into_iter().map(|p| p.syntax().to_string()).join(", "); + let pats_str = pats.into_iter().map(|p| p.to_string()).join(", "); return from_text(&format!("({})", pats_str)); fn from_text(text: &str) -> ast::TuplePat { -- cgit v1.2.3