diff options
author | Josh Mcguigan <[email protected]> | 2020-03-23 05:42:32 +0000 |
---|---|---|
committer | Josh Mcguigan <[email protected]> | 2020-03-23 06:28:25 +0000 |
commit | 2afccbe47727d9d2787f76efd67f5b5d9ff1d55a (patch) | |
tree | 01cd96ea1bbcd492df1082907a1106b89aab7eaa /crates/ra_syntax/src/ast | |
parent | baa11d52f45fed76a65863c64938e43443bb9bb8 (diff) |
implement fill match arm assist for tuple of enums
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r-- | crates/ra_syntax/src/ast/make.rs | 9 |
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 | ||
139 | pub 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 | |||
139 | pub fn tuple_struct_pat( | 148 | pub 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>, |