aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/ast/mod.rs')
-rw-r--r--crates/ra_syntax/src/ast/mod.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/crates/ra_syntax/src/ast/mod.rs b/crates/ra_syntax/src/ast/mod.rs
index 6b0d62610..f20714ede 100644
--- a/crates/ra_syntax/src/ast/mod.rs
+++ b/crates/ra_syntax/src/ast/mod.rs
@@ -1,6 +1,7 @@
1mod generated; 1mod generated;
2 2
3use std::marker::PhantomData; 3use std::marker::PhantomData;
4use std::string::String as RustString;
4 5
5use itertools::Itertools; 6use itertools::Itertools;
6 7
@@ -76,7 +77,7 @@ pub trait DocCommentsOwner<'a>: AstNode<'a> {
76 77
77 /// Returns the textual content of a doc comment block as a single string. 78 /// Returns the textual content of a doc comment block as a single string.
78 /// That is, strips leading `///` and joins lines 79 /// That is, strips leading `///` and joins lines
79 fn doc_comment_text(self) -> String { 80 fn doc_comment_text(self) -> RustString {
80 self.doc_comments() 81 self.doc_comments()
81 .map(|comment| { 82 .map(|comment| {
82 let prefix = comment.prefix(); 83 let prefix = comment.prefix();
@@ -133,6 +134,12 @@ impl<'a> Char<'a> {
133 } 134 }
134} 135}
135 136
137impl<'a> String<'a> {
138 pub fn text(&self) -> &SmolStr {
139 &self.syntax().leaf_text().unwrap()
140 }
141}
142
136impl<'a> Comment<'a> { 143impl<'a> Comment<'a> {
137 pub fn text(&self) -> &SmolStr { 144 pub fn text(&self) -> &SmolStr {
138 self.syntax().leaf_text().unwrap() 145 self.syntax().leaf_text().unwrap()