aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2020-01-10 20:42:04 +0000
committerFlorian Diebold <[email protected]>2020-01-12 10:34:52 +0000
commit2c11a9b42deca002bcd4a669dcbb3ab972b939d8 (patch)
treeb4221236837f69190f133291979e0121a69563c9 /crates/ra_syntax/src
parent86d2af9f7b3f6af2ea9e4eca2584aa501b60aa14 (diff)
Qualify paths in 'fill match arms' assist
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r--crates/ra_syntax/src/ast/make.rs5
1 files changed, 3 insertions, 2 deletions
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<Item = ast::Pat>) ->
117 } 117 }
118} 118}
119 119
120pub fn path_pat(path: ast::Path) -> ast::PathPat { 120/// Returns a `BindPat` if the path has just one segment, a `PathPat` otherwise.
121pub fn path_pat(path: ast::Path) -> ast::Pat {
121 let path_str = path.syntax().text().to_string(); 122 let path_str = path.syntax().text().to_string();
122 return from_text(path_str.as_str()); 123 return from_text(path_str.as_str());
123 fn from_text(text: &str) -> ast::PathPat { 124 fn from_text(text: &str) -> ast::Pat {
124 ast_from_text(&format!("fn f({}: ())", text)) 125 ast_from_text(&format!("fn f({}: ())", text))
125 } 126 }
126} 127}