diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-01-12 11:23:11 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-01-12 11:23:11 +0000 |
commit | 21be386db8e8019d25c2529313d0371f91a15cb3 (patch) | |
tree | b4221236837f69190f133291979e0121a69563c9 /crates/ra_syntax | |
parent | 86d2af9f7b3f6af2ea9e4eca2584aa501b60aa14 (diff) | |
parent | 2c11a9b42deca002bcd4a669dcbb3ab972b939d8 (diff) |
Merge #2809
2809: Qualify paths in 'fill match arms' assist r=matklad a=flodiebold
Co-authored-by: Florian Diebold <[email protected]>
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 | } |