mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
Qualify paths in 'fill match arms' assist
This commit is contained in:
parent
86d2af9f7b
commit
2c11a9b42d
3 changed files with 55 additions and 19 deletions
|
@ -117,10 +117,11 @@ pub fn record_pat(path: ast::Path, pats: impl IntoIterator<Item = ast::Pat>) ->
|
|||
}
|
||||
}
|
||||
|
||||
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))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue