diff options
author | Florian Diebold <[email protected]> | 2020-01-10 20:42:04 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2020-01-12 10:34:52 +0000 |
commit | 2c11a9b42deca002bcd4a669dcbb3ab972b939d8 (patch) | |
tree | b4221236837f69190f133291979e0121a69563c9 /crates/ra_syntax | |
parent | 86d2af9f7b3f6af2ea9e4eca2584aa501b60aa14 (diff) |
Qualify paths in 'fill match arms' assist
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r-- | crates/ra_syntax/src/ast/make.rs | 5 |
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 | ||
120 | pub fn path_pat(path: ast::Path) -> ast::PathPat { | 120 | /// Returns a `BindPat` if the path has just one segment, a `PathPat` otherwise. |
121 | pub 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 | } |