about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDropDemBits <r3usrlnd@gmail.com>2023-12-14 18:45:20 -0500
committerDropDemBits <r3usrlnd@gmail.com>2024-02-08 19:09:33 -0500
commit039b3d0abbf1ff01229dcd58be458dc86ed06485 (patch)
tree9762907fbcb73fcbbb06fee0c0f44561daba837a
parent0e39257e5be05458596fb5cce9bb806081ea0cf1 (diff)
downloadrust-039b3d0abbf1ff01229dcd58be458dc86ed06485.tar.gz
rust-039b3d0abbf1ff01229dcd58be458dc86ed06485.zip
Add `make::ext::expr_self`
Shortcut version of `make::expr_path(make::path_unqualified(make::path_segment_self()))`
-rw-r--r--crates/syntax/src/ast/make.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/crates/syntax/src/ast/make.rs b/crates/syntax/src/ast/make.rs
index 764221fc8bf..b6e5e6a4e42 100644
--- a/crates/syntax/src/ast/make.rs
+++ b/crates/syntax/src/ast/make.rs
@@ -68,6 +68,9 @@ pub mod ext {
     pub fn expr_ty_new(ty: &ast::Type) -> ast::Expr {
         expr_from_text(&format!("{ty}::new()"))
     }
+    pub fn expr_self() -> ast::Expr {
+        expr_from_text("self")
+    }
 
     pub fn zero_number() -> ast::Expr {
         expr_from_text("0")