mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-22 11:24:24 +00:00
Merge #6476
6476: Add missing AssocItems in add_custom_impl assist r=matklad a=Veykril ```rust use std::fmt; #[derive(Debu<|>g)] struct Foo { bar: String, } ``` -> ```rust use std::fmt; struct Foo { bar: String, } impl fmt::Debug for Foo { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { ${0:todo!()} } } ``` Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
commit
dac7060382
5 changed files with 240 additions and 110 deletions
|
@ -25,6 +25,10 @@ pub fn assoc_item_list() -> ast::AssocItemList {
|
|||
ast_from_text("impl C for D {};")
|
||||
}
|
||||
|
||||
pub fn impl_trait(trait_: ast::Path, ty: ast::Path) -> ast::Impl {
|
||||
ast_from_text(&format!("impl {} for {} {{}}", trait_, ty))
|
||||
}
|
||||
|
||||
pub fn path_segment(name_ref: ast::NameRef) -> ast::PathSegment {
|
||||
ast_from_text(&format!("use {};", name_ref))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue