mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
review comments
This commit is contained in:
parent
2afccbe477
commit
bc48c9d511
2 changed files with 114 additions and 17 deletions
|
@ -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<Item = ast::Pat>) -> 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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue