Properly qualify trait methods in qualify_path assist

This commit is contained in:
Lukas Wirth 2020-10-14 21:40:51 +02:00
parent d983f18df7
commit bc11475a2a
5 changed files with 117 additions and 69 deletions

View file

@ -172,6 +172,9 @@ pub fn expr_call(f: ast::Expr, arg_list: ast::ArgList) -> ast::Expr {
pub fn expr_method_call(receiver: ast::Expr, method: &str, arg_list: ast::ArgList) -> ast::Expr {
expr_from_text(&format!("{}.{}{}", receiver, method, arg_list))
}
pub fn expr_ref(expr: ast::Expr, exclusive: bool) -> ast::Expr {
expr_from_text(&if exclusive { format!("&mut {}", expr) } else { format!("&{}", expr) })
}
fn expr_from_text(text: &str) -> ast::Expr {
ast_from_text(&format!("const C: () = {};", text))
}