From 2c11a9b42deca002bcd4a669dcbb3ab972b939d8 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Fri, 10 Jan 2020 21:42:04 +0100 Subject: Qualify paths in 'fill match arms' assist --- crates/ra_syntax/src/ast/make.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'crates/ra_syntax') diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs index 9781b748f..eef45090d 100644 --- a/crates/ra_syntax/src/ast/make.rs +++ b/crates/ra_syntax/src/ast/make.rs @@ -117,10 +117,11 @@ pub fn record_pat(path: ast::Path, pats: impl IntoIterator) -> } } -pub fn path_pat(path: ast::Path) -> ast::PathPat { +/// Returns a `BindPat` if the path has just one segment, a `PathPat` otherwise. +pub fn path_pat(path: ast::Path) -> ast::Pat { let path_str = path.syntax().text().to_string(); return from_text(path_str.as_str()); - fn from_text(text: &str) -> ast::PathPat { + fn from_text(text: &str) -> ast::Pat { ast_from_text(&format!("fn f({}: ())", text)) } } -- cgit v1.2.3