aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax
diff options
context:
space:
mode:
Diffstat (limited to 'crates/syntax')
-rw-r--r--crates/syntax/src/algo.rs5
-rw-r--r--crates/syntax/src/ast/make.rs4
2 files changed, 8 insertions, 1 deletions
diff --git a/crates/syntax/src/algo.rs b/crates/syntax/src/algo.rs
index 7ac6076a4..320c430c9 100644
--- a/crates/syntax/src/algo.rs
+++ b/crates/syntax/src/algo.rs
@@ -349,7 +349,10 @@ pub struct SyntaxRewriter<'a> {
349 349
350impl fmt::Debug for SyntaxRewriter<'_> { 350impl fmt::Debug for SyntaxRewriter<'_> {
351 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 351 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
352 f.debug_struct("SyntaxRewriter").field("replacements", &self.replacements).finish() 352 f.debug_struct("SyntaxRewriter")
353 .field("replacements", &self.replacements)
354 .field("insertions", &self.insertions)
355 .finish()
353 } 356 }
354} 357}
355 358
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
28pub fn impl_trait(trait_: ast::Path, ty: ast::Path) -> ast::Impl {
29 ast_from_text(&format!("impl {} for {} {{}}", trait_, ty))
30}
31
28pub fn path_segment(name_ref: ast::NameRef) -> ast::PathSegment { 32pub 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}