diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-11-07 18:21:11 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-11-07 18:21:11 +0000 |
commit | dac70603821c3f4785a285e837b220addb16d13b (patch) | |
tree | a0adc6df6a84b57bcba97fd1835a2da8020f5258 /crates/syntax/src | |
parent | f3fe6561c00a07a7d6131db42983cbc3eb658957 (diff) | |
parent | 19443c1fa30e5a360c84f82d0b7aac733ea2e240 (diff) |
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 <[email protected]>
Diffstat (limited to 'crates/syntax/src')
-rw-r--r-- | crates/syntax/src/ast/make.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/syntax/src/ast/make.rs b/crates/syntax/src/ast/make.rs index b1578820f..876659a2b 100644 --- a/crates/syntax/src/ast/make.rs +++ b/crates/syntax/src/ast/make.rs | |||
@@ -25,6 +25,10 @@ pub fn assoc_item_list() -> ast::AssocItemList { | |||
25 | ast_from_text("impl C for D {};") | 25 | ast_from_text("impl C for D {};") |
26 | } | 26 | } |
27 | 27 | ||
28 | pub fn impl_trait(trait_: ast::Path, ty: ast::Path) -> ast::Impl { | ||
29 | ast_from_text(&format!("impl {} for {} {{}}", trait_, ty)) | ||
30 | } | ||
31 | |||
28 | pub fn path_segment(name_ref: ast::NameRef) -> ast::PathSegment { | 32 | pub fn path_segment(name_ref: ast::NameRef) -> ast::PathSegment { |
29 | ast_from_text(&format!("use {};", name_ref)) | 33 | ast_from_text(&format!("use {};", name_ref)) |
30 | } | 34 | } |